Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Macro substitution in T-SQL
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00979670
Message ID:
00979671
Views:
13
See EXECUTE() statement an sp_executesql system stored procedure in BOL.
DECLARE @cond varchar(4000), @sql varchar(4000)
SET @Cond = ' name like ''%John%'' '
SET @sql = 'SELECT * FROM customers where ' + @Cond
EXECUTE (@sql)
Check also How to return a value from dynamicaly executed T-SQL code FAQ #8130

>Which is the equivalent in T-SQL SQL Server to the "&" symbol, VFP macro substitution?.
>
>E.g., I need to do this VFP's example in T-SQL.
>
>
>lcCond = " name like '%John%' "
>SELECT * FROM customers where &lccond
>
>
>or
>
>
>lcCond = " invoicenumber > 1056 "
>SELECT * FROM invoices where &lccond
>
>
>
>How it would be in T-SQL ?
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform