Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro
Message
General information
Forum:
Microsoft SQL Server
Category:
Database management
Title:
Re: Macro
Miscellaneous
Thread ID:
00746458
Message ID:
00746460
Views:
20
You can build SQL string and run it with EXECUTE command or sp_executesql system sproc. For example,
USE pubs
Declare @lcTablename Varchar(30), @SqlStr nvarchar(256)
Set @lcTableName = 'Sales'
SET @SqlStr = 'SELECT * FROM sales'
EXECUTE(@SqlStr)
>Hi All:
> Is there a way I can create a macro in SQL?
>For Example
>This is what I want to do.
>
>Declare @lcTablename Varchar(30)
>Set @lcTableName = (Select Name from cSetUp0
>
>Select * From @lcTableName
>
>@lcTableName varries depending on the situations. I do not want to issue the same code everytime. I want to store the table name in @lcTablename, just like vfp.
>
>Thanks
>MA
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform