sql - Dynamic Linked Server Query -
Is it possible to create a dynamic query for the linked server (and if so)? For example:
@linked surfer varchar (50) @ var1 varchar (10) @ var2 varchar (10) * choose from openquery (@linked surfer, ' Select c1, from C2 to T1, where p1 = @ var1 and p2 = @ var2 ')
Example
exec (select 'from openquery * (' + @ linked surfer + ',' select 'c1, c2 to t1, where p1 =' '+ @ Var1 + '' and p2 = '' + @ var2 + '' ')
Be sure to save from SQL injection
Comments
Post a Comment