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 |
|
shifis
Posting Yak Master
157 Posts |
Posted - 2006-03-08 : 19:23:18
|
| I have the next code: declare @SaldoNuevo decimal(9,2)SET @SaldoActual = ( SELECT SALDO FROM TBSALDOS WHERE ID=@ID)But I want to do a select that return 3 field and set the values to three variables.declare @SaldoNuevo decimal(9,2)declare @LastName varchar(30)declare @Name varchar(30)SET @SaldoActual, @LastName, @Name = ( SELECT SALDO, LASTNAME, NAME FROM TBSALDOS WHERE ID=@ID)Hope you undestand my English |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-08 : 19:24:20
|
| [code]SET @SaldoActual = SALDO, @LastName = LASTNAME, @Name = NAMEFROM TBSALDOSWHERE ID=@ID[/code]----------------------------------'KH' |
 |
|
|
shifis
Posting Yak Master
157 Posts |
Posted - 2006-03-08 : 19:35:27
|
| I got this error:Server: Msg 170, Level 15, State 1, Line 39Line 39: Incorrect syntax near ','. |
 |
|
|
shifis
Posting Yak Master
157 Posts |
Posted - 2006-03-08 : 19:39:56
|
| Got it!Is SELECT instead of SETSELECT @SaldoActual = SALDO, @LastName = LASTNAME, @Name = NAMEFROM TBSALDOSWHERE ID=@IDThanks!! |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-08 : 19:44:52
|
quote: Originally posted by shifis I got this error:Server: Msg 170, Level 15, State 1, Line 39Line 39: Incorrect syntax near ','.
Sorry it should be SELECT instead of SET----------------------------------'KH' |
 |
|
|
|
|
|
|
|