Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Split Words into individual rows

Author  Topic 

sachingovekar
Posting Yak Master

101 Posts

Posted - 2008-07-07 : 00:56:07
Hi,

I have a following data in sql server table with userid, gender and city columns.

Userid Gender City
AB001, RI003, TL006 Male Texas

I require the output as
Userid Gender City
AB001 Male Texas
RI003 Male Texas
TL006 Male Texas

Please i need this ASAP.

Regards,
Sachin

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-07 : 00:59:37
make use of the function here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=25830&SearchTerms=CSVTable
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-07 : 02:30:55
if you're using sql 2005, you can use CROSS APPLY to join to this function and get your result. something like:-

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104485
Go to Top of Page

sachingovekar
Posting Yak Master

101 Posts

Posted - 2008-07-11 : 01:26:01
the function shows results only for first column i.e
AB001
RI003
TL006

I want the output as:
Userid Gender City
AB001 Male Texas
RI003 Male Texas
TL006 Male Texas

Kindly give me the code please
Thanks for the reply
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-11 : 01:28:13
as visakh said you need to use CROSS APPLY


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sachingovekar
Posting Yak Master

101 Posts

Posted - 2008-07-11 : 01:45:49
i am using sql server 2000
Go to Top of Page
   

- Advertisement -