Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OpenRowSet
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00584963
Message ID:
00585111
Views:
37
Thanks. It is working really well now. I started with your example from Pubs and got mine to work right after.


>It looks like sp_executesql doesn't like such complex parameter. Let's try to get it work w/o using parameters.
>...
>set @sql = 'SELECT * FROM OpenRowset(''SQLOLEDB'', ''z'';''z'';''zz'', +
>REPLACE(@Query,'''', '''''') + ''')'
>
>--select @sql
>
>exec sp_executesql @sql
>
>
I got it work on Pubs..Sales table. Here's my test code for reference.
declare @Query nvarchar(400)
>declare @SQL nvarchar(400)
>set @Query = 'SELECT * FROM Pubs..Stores where state = ''CA'''
>set @sql = 'SELECT * FROM OpenRowset(''SQLOLEDB.1'', ''zzz''; ''zz''; ''z'', ''' +
>     REPLACE(@Query,'''', '''''') + ''')'
>exec sp_executesql @sql
>
>
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform