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)
 St.Proc. Problem using variables in SQL

Author  Topic 

Joe Jalbert
Starting Member

2 Posts

Posted - 2003-05-09 : 09:48:31
declare @myvar varchar(100)
set @myvar = 'Reservations'
select * from @myvar


This doesn't work. Even though myvar will hold the name of an existing table, this syntax is not accepted in SQL 7.

Clearly, there is some kind of "do not work" switch I have set. Any ideas?

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-05-09 : 10:05:44
Introduction to Dynamic SQL (Part 1)
Introduction to Dynamic SQL (Part 2)


Jay White
{0}
Go to Top of Page

Joe Jalbert
Starting Member

2 Posts

Posted - 2003-05-09 : 10:26:45
That's it, thanks! It takes me back to the days of dBase II and macro-izing variables.

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-05-09 : 19:02:54
quote:
That's it, thanks! It takes me back to the days of dBase II and macro-izing variables.
Ahhhhhhhhhhhhhhhhhhhh, YES!!!! That is one feature I miss very much.

Go to Top of Page
   

- Advertisement -