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 2008 Forums
 Transact-SQL (2008)
 store value in our variable from other table

Author  Topic 

arsheena.alam
Starting Member

1 Post

Posted - 2011-03-26 : 08:10:54
hi,

I have declared a variable @franchiseId.
Now i want To get the value of [franchisename]column into this variable from a table i.e
the variable @franchiseId should contain the value of [franchisename] which is in franchise table
I want to know the command to execute the above scenerio!!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-03-26 : 08:21:06
[code]
select @franchiseId = [franchisename]
from franchise
where < some condition here >
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-03-27 : 01:27:28
make sure you needs a single value satisfying the condition or else you might have to use table variable instead.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -