|
Posted by Erland Sommarskog on 01/26/07 22:57
paddy_nyr (mpprpp@yahoo.com) writes:
> I want to use an input parameter as my filename, but I get a synatax
> error message. Howerve, when I hard code the filename the proc compiles
> successfully.
Dynamic SQL is the only way out. See
http://www.sommarskog.se/dynamic_sql.html#OPENQUERY
for an example with OPENQUERY that you can use as starter.
If you've never seen dynamic SQL before, I recommend that you read the
entire article, before you start using it all over town.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|