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 |
grizzlee
Starting Member
6 Posts |
Posted - 2008-04-22 : 04:53:57
|
Hi I hope my post is in the right place, because it is the first time i post here.I have a table with index and value for ex.I'd like to read the exact value in a variable.something like :SELECT @var="select val from mytable where index=234"because i need to know the value of val in order to run or not other instructionsif @var =0 then do something else do something else the problem is that i tried all the possible ways and did not manage to come to a result |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-22 : 05:09:29
|
[code]Select @var = val from mytable where index=234[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
grizzlee
Starting Member
6 Posts |
Posted - 2008-04-22 : 05:15:54
|
ohh, it is so simple and it works :)thanks a lot |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-22 : 05:30:02
|
orset @var = (select val from mytable where index=234)Provided the query returns a single valueMadhivananFailing to plan is Planning to fail |
|
|
grizzlee
Starting Member
6 Posts |
Posted - 2008-04-22 : 05:49:28
|
ok thanx,a lot guys, now i have another question and i said it it better to ask it here than to open a new postHow can i find a schema from a database when i only know the owner, and read the value in a variable. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-22 : 08:56:48
|
Find it in Information_schema.tables viewMadhivananFailing to plan is Planning to fail |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-22 : 08:57:32
|
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=101479MadhivananFailing to plan is Planning to fail |
|
|
|
|
|