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
 String variable

Author  Topic 

Kwisatz
Starting Member

14 Posts

Posted - 2007-08-17 : 07:02:50
Hi

I have a problem with a string variable which looks something like this

@VARIABLE = 'RTY,YTUK,GHJ'

I need to be able to select (RTY) the first individual values seperated by the commas to be used as a variable elsewhere in my SQL script.

Following this I need to use the second value (YTUK) to be run in the same piece of code. Followed by the 3rd value (GHJ)

Can anyone tell me how to do this?

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-17 : 07:07:13
There are many split functions availabe here at SQLTeam. CSVSplit is one of them. fnParseList is another.
Feel free to search. Some of them even come with example code!



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-17 : 08:39:29
http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -