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
 SQL Server Development (2000)
 pls help on query

Author  Topic 

ppuar
Starting Member

28 Posts

Posted - 2002-10-28 : 18:01:24
declare @test varchar(500)

set @test = ''

select sq.iSurveyId,
qr.iQuestionId,
qr.iResponseId,
(select @test = @test + vchResponseText from response where iResponseId = qr.iResponseId) 'vchResponseDesc'
from vsurveyquestion sq left join vquestionresponse qr
on sq.iQuestionId = qr.iQuestionId,
question q
where sq.iSurveyId = 23
and q.iQuestionId = sq.iQuestionId
and q.iQuestionTypeId <> 3 order by sq.iSurveyId, sq.siSeqNum

print @test

give the following error message:
Server: Msg 170, Level 15, State 1, Line 8
Line 8: Incorrect syntax near '='.

I want to store all the values from the embedded select statement into one var. Does anyone know what I am doing wrong?

Thanks

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-10-28 : 18:52:40
If you're trying to return a comma delimited list read this.

http://www.sqlteam.com/item.asp?ItemID=11021

Go to Top of Page
   

- Advertisement -