From: Heather on
hello!

here is my problem.

I have built a dynamic string called @filepath as char50

i need to place it in:
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', @filePath, 'SELECT
* FROM [Sheet1$]')


does any one know the correct syntax??? for passing a parameter here
From: Plamen Ratchev on
OPENROWSET does not accept variables as arguments. You have to use dynamic SQL to build your query (append the
@filePath) and execute.

--
Plamen Ratchev
http://www.SQLStudio.com
From: Heather on
On Mar 11, 1:25 pm, Plamen Ratchev <Pla...(a)SQLStudio.com> wrote:
> OPENROWSET does not accept variables as arguments. You have to use dynamic SQL to build your query (append the
> @filePath) and execute.
>
> --
> Plamen Ratchevhttp://www.SQLStudio.com

thank you!! i wanted to avoid dynamic sql..sigh...

Can i execute a dynamic sql statment within a stored procedure?
From: Plamen Ratchev on
Heather wrote:
> Can i execute a dynamic sql statment within a stored procedure?

Yes.

--
Plamen Ratchev
http://www.SQLStudio.com