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 2000 Forums
 Transact-SQL (2000)
 Defining variable with select

Author  Topic 

bushmobile
Starting Member

2 Posts

Posted - 2004-07-29 : 05:58:04
Hello all,

Is it possible to define a variable using a SELECT statement, as long as the SELECT only has a single outcome.

eg. variable = SELECT....

This is a very simple question but i'm a novice to SQL and i can't find the answer anywhere on the internet.

Thanks

Steven

nr
SQLTeam MVY

12543 Posts

Posted - 2004-07-29 : 06:06:07
nope but you can populate it.

declare @i int
select @i = val from ...
select @i = (select val from ...)


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

bushmobile
Starting Member

2 Posts

Posted - 2004-07-29 : 06:14:53
just what i needed, thanks
Go to Top of Page
   

- Advertisement -