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
 distribute a,b,c,d, and so on in individual rows

Author  Topic 

artbishop
Starting Member

18 Posts

Posted - 2010-02-08 : 02:35:00
I am new to sql and could anyone help me distribute a,b,c,d,and so on.. to individual rows..

1 a
2 b
3 c
4 d
5 e
6 f

a,b,c,d,e,f,g,h,i, are entered in one field i.e. TESTFIELD

thank you

Sachin.Nand

2937 Posts

Posted - 2010-02-08 : 03:03:48
declare @tbl as table(val varchar(20))
insert into @tbl
select 'a'union all
select 'b'union all
select 'c'union all
select 'd'union all
select 'e'
declare @str varchar(max)
set @str=''
select @str= @str + ',' + val from @tbl
select @str

PBUH
Go to Top of Page

artbishop
Starting Member

18 Posts

Posted - 2010-02-08 : 03:07:42
i was trying to follow the steps posted here.. [url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033#315323[/url]

Go to Top of Page

artbishop
Starting Member

18 Posts

Posted - 2010-02-08 : 03:14:16
my question is also similar to the question posted in :
[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=135470&SearchTerms=delimit[/url]

where I need to split data into individual rows...

Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-02-08 : 03:35:26
Try this..

http://sqlblogcasts.com/blogs/madhivanan/archive/2008/03/15/splitting-csv-to-columns.aspx

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

artbishop
Starting Member

18 Posts

Posted - 2010-02-08 : 04:14:19
...not working ... =(



Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-02-08 : 04:15:51
What You tried post your query!

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

artbishop
Starting Member

18 Posts

Posted - 2010-02-08 : 04:21:03
i can't make it work using dreamweaver...i don't know if it is possible to include it as a recordset
Go to Top of Page

artbishop
Starting Member

18 Posts

Posted - 2010-02-08 : 04:23:07
i tried the article posted by Transac Charlie and it's working when I use SQL query..however, I can't make it work when I try to use it within dreamweaver (asp file)

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=119254&SearchTerms=delimit
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-08 : 05:09:32
why cant you make it a udf and call from dreamweaver code?
Go to Top of Page
   

- Advertisement -