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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-04-21 : 22:28:52
|
| S K Charan writes "declare @a int,@b intselect @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 resultsi have to do manipulation. So how to tackle this problem.Hope u can help u out.Thanks a lot.RegardsCharanFor Amrok & CoIndia" |
|
|
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=@bwhile exist (select emp_name from #temp)beginselect @empname=max(emp_name) from #temp.....delete from #temp where emp_name=@empnameendgo-------------------------------------------------------------- |
 |
|
|
|
|
|