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 |
|
jotmenow
Starting Member
12 Posts |
Posted - 2006-10-06 : 16:52:15
|
| dear allAny one of you know the syntax how to select a value into a variable from a simple sql statement.thanks in advanceAjay. |
|
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2006-10-06 : 16:57:43
|
| declare @var1 as varchar(10)select @var1 = 'My string'or select @var1 = mytable.myfield where ID= 123 |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-10-07 : 01:38:52
|
select @var1 = mytable.myfield FROM mytable where ID= 123 Kristen |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-10-07 : 07:56:46
|
| OR Make sure your query returns only one values Set @var1 = (Select mytable.myfield from mytable where id =123)Chirag |
 |
|
|
|
|
|