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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 WHILE in SELECT query

Author  Topic 

raghavlyon
Starting Member

5 Posts

Posted - 2006-05-18 : 15:09:36
Hi, I am trying to use WHILE in SELECT query like CASE. This is just to avoid the cursor so that I can concatenate the result of a column of resluting row into one variable. Is there any way to achieve this with the use of WHILE in SELECT query.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-05-18 : 15:33:40
???

DECLARE @Temp VARCHAR(8000)

SELECT @Temp = ''

SELECT @Temp = @Temp + MyField + ','
FROM MyTable
Go to Top of Page

raghavlyon
Starting Member

5 Posts

Posted - 2006-05-18 : 15:41:37
Thanks
Go to Top of Page

raghavlyon
Starting Member

5 Posts

Posted - 2006-05-18 : 15:56:23
i got the result but now problem is that i cannot declare 'text' variable which is giving me a problem becuase the method which was mentioned by you is good till the size goes to 8000 after that canbnot use.
Is there any other way to declare a variable of datatype 'text'. That will be great.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-19 : 02:17:52
Search for 8000 in this topic
http://sqlteam.com/forums/topic.asp?TOPIC_ID=55210

Madhivanan

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

- Advertisement -