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)
 Assigning more than one record to a variable

Author  Topic 

OwamAthi
Starting Member

4 Posts

Posted - 2009-10-13 : 01:22:32
morning,

I have a problem assigning the results of a query to a local variable. i get an error that says "Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."

this is what i tried:

declare @result varchar(max)
set @result(select code, name from client, bank where client.bank_code = bank.bank_code)

and yes i want the query to return more than one records.

your assistence will be appreciated.

Bongs Zwane

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-13 : 01:27:04
What are you trying to achieve with @result? Can you use a temporary table or a table variable instead?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-10-21 : 13:03:30
are you trying to generate comma seperated list?
Go to Top of Page
   

- Advertisement -