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)
 Result ASAP

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-21 : 22:28:52
S K Charan writes "declare @a int,@b int
select @a=(select emp_name from [emp_table] where Dept=@b)

In this SQl, The sub query returns more than one value.
I have to store the reults in variable and using that results
i have to do manipulation. So how to tackle this problem.
Hope u can help u out.Thanks a lot.

Regards
Charan
For Amrok & Co
India"

Nazim
A custom title

1408 Posts

Posted - 2002-04-22 : 00:40:04
you can strore the values in temp table and work with it . on the following lines.

eg:

select emp_name into #temp from [emp_table] where Dept=@b


while exist (select emp_name from #temp)
begin
select @empname=max(emp_name) from #temp
.....

delete from #temp where emp_name=@empname
end

go

--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -