Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
b.veenings
Yak Posting Veteran
96 Posts |
Posted - 2007-11-20 : 14:41:00
|
| hi all,does anyone know if its possible to put an variable into an odbcstring?this openrowset is inside an cursor wich is called from an sp@server varchar(50),@database varchar(50)what i want i something like this:SELECT a.*FROM OPENROWSET('@server','@database';'sa';'MyPass', 'SELECT * FROM pubs.dbo.authors ORDER BY au_lname, au_fname') AS aGOi already tried it but he says he can not find the server and when i put it hardcoded he works fine./cheersbenjiNeed an SQLDB consultant?check www.veeningsengineering.nl |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2007-11-20 : 23:01:10
|
| see if this worksexec ('SELECT a.*FROM OPENROWSET(' + @server +',' + @database + ';''sa'';''MyPass'',''SELECT * FROM pubs.dbo.authors ORDER BY au_lname, au_fname'') AS a') |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|