Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OpenRowSet
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00584963
Message ID:
00585111
Vues:
39
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform