Click here to Skip to main content
15,892,005 members
Home / Discussions / Database
   

Database

 
AnswerRe: how to return the douplictate records across only some column using SQL Query ? please help me ! : Pin
Blue_Boy5-Dec-09 8:35
Blue_Boy5-Dec-09 8:35 
GeneralRe: how to return the douplictate records across only some column using SQL Query ? please help me ! : Pin
AJ Hoge5-Dec-09 21:31
AJ Hoge5-Dec-09 21:31 
GeneralRe: how to return the douplictate records across only some column using SQL Query ? please help me ! : Pin
Blue_Boy6-Dec-09 0:41
Blue_Boy6-Dec-09 0:41 
QuestionSQLite3 program getting name of table Pin
bbranded4-Dec-09 8:00
bbranded4-Dec-09 8:00 
AnswerRe: SQLite3 program getting name of table Pin
loyal ginger4-Dec-09 10:55
loyal ginger4-Dec-09 10:55 
GeneralRe: SQLite3 program getting name of table Pin
bbranded7-Dec-09 4:35
bbranded7-Dec-09 4:35 
QuestionT-SQL Code to parse and address [modified] Pin
korrowna4-Dec-09 3:48
korrowna4-Dec-09 3:48 
AnswerRe: T-SQL Code to parse and address Pin
Niladri_Biswas6-Dec-09 17:47
Niladri_Biswas6-Dec-09 17:47 
Let me know if it helps

Sample data

declare @t table(completeaddress varchar(100))
insert into @t
	select '1234 McKean Street' union all select '1234 McKean Street' union all
	select '1234 E McKean Street' union all select '1234 E McKean Street' 



Query

select 
	StreetNum = 'StreetNum : ' + SUBSTRING(completeaddress,1,4) +',' 
	,Direction = 'Direction : ' + 
	
				case when ltrim(rtrim(SUBSTRING(completeaddress,5,2))) In('N','S','E','W') 
					 then SUBSTRING(completeaddress,5,2) else '' end + ','
	,StreetName = 'StreetName : ' + 
	
	case when ltrim(rtrim(SUBSTRING(completeaddress,5,2))) In('N','S','E','W')
	then SUBSTRING(completeaddress,7,LEN(completeaddress)) 
	else SUBSTRING(completeaddress,6,LEN(completeaddress)) end	
from @t


Output:

StreetNum Direction StreetName
StreetNum : 1234,	Direction : ,	StreetName : McKean Street
StreetNum : 1234,	Direction : ,	StreetName : McKean Street
StreetNum : 1234,	Direction :  E,	StreetName :  McKean Street
StreetNum : 1234,	Direction :  E,	StreetName :  McKean Street

Smile | :)

Niladri Biswas

QuestionCursor issue Pin
AndyInUK3-Dec-09 23:28
AndyInUK3-Dec-09 23:28 
AnswerRe: Cursor issue Pin
Ashfield4-Dec-09 1:20
Ashfield4-Dec-09 1:20 
GeneralRe: Cursor issue Pin
AndyInUK4-Dec-09 1:28
AndyInUK4-Dec-09 1:28 
GeneralRe: Cursor issue Pin
Ashfield4-Dec-09 2:16
Ashfield4-Dec-09 2:16 
AnswerRe: Cursor issue Pin
Bassam Saoud4-Dec-09 10:41
Bassam Saoud4-Dec-09 10:41 
GeneralRe: Cursor issue Pin
Shameel4-Dec-09 23:42
professionalShameel4-Dec-09 23:42 
AnswerRe: Cursor issue Pin
RyanEK6-Dec-09 13:18
RyanEK6-Dec-09 13:18 
AnswerRe: Cursor issue [modified] Pin
Niladri_Biswas7-Dec-09 21:59
Niladri_Biswas7-Dec-09 21:59 
QuestionPerformance tip on multiple selects to retrieve alot of BLOBS? Pin
Thomas ST3-Dec-09 22:28
Thomas ST3-Dec-09 22:28 
AnswerRe: Performance tip on multiple selects to retrieve alot of BLOBS? Pin
Ashfield4-Dec-09 1:27
Ashfield4-Dec-09 1:27 
AnswerRe: Performance tip on multiple selects to retrieve alot of BLOBS? Pin
Bassam Saoud4-Dec-09 10:44
Bassam Saoud4-Dec-09 10:44 
QuestionAdding an Identity Later T-SQL Pin
Vimalsoft(Pty) Ltd3-Dec-09 21:17
professionalVimalsoft(Pty) Ltd3-Dec-09 21:17 
AnswerRe: Adding an Identity Later T-SQL Pin
Mycroft Holmes3-Dec-09 22:11
professionalMycroft Holmes3-Dec-09 22:11 
GeneralRe: Adding an Identity Later T-SQL Pin
Vimalsoft(Pty) Ltd4-Dec-09 0:49
professionalVimalsoft(Pty) Ltd4-Dec-09 0:49 
QuestionGeneral question on DB normalization Pin
Dewald3-Dec-09 20:59
Dewald3-Dec-09 20:59 
AnswerRe: General question on DB normalization Pin
Mycroft Holmes3-Dec-09 22:17
professionalMycroft Holmes3-Dec-09 22:17 
GeneralRe: General question on DB normalization Pin
Dewald3-Dec-09 22:44
Dewald3-Dec-09 22:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.