Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

including parameters in OPENQUERY

DECLARE @TSQL varchar(8000), @VAR char(2)
SELECT  @VAR = 'CA'
SELECT  @TSQL = 'SELECT * FROM OPENQUERY(MyLinkedServer,''SELECT * FROM pubs.dbo.authors WHERE state = ''''' + @VAR + ''''''')'
EXEC (@TSQL)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #including #parameters #OPENQUERY
ADD COMMENT
Topic
Name
6+7 =