Cannnot execute Dynamic SQL inside stored procedure

N

Net

Hi,

I'm using ADO.NET to execute a stored proc. The stored proc contains a
dynamic sql which will build the INSERT or UPDATE statement for execution at
the end of the stored proc.

I've a line that does some dummy inserts into a table before executing that
dynamic sql, like

exec ('INSERT INTO....')
exec (@sql)

The line of the INSERT INTO runs fine, but the stored proc just won't
execute the @sql. I tried to run the stored proc in the SQL Query Analyzer
and it works just fine.

Can anyone please help??

TIA.

Brgds,
Janet
 
J

Jagan Mohan

Better try using
sp_executesql @sql

Also @sql should be declared NVARCHAR

If this is not working out please send me the code.

I will check into it

Thanks
Jagan Mohan
Software Engineer
MCP
 
Joined
Jul 18, 2007
Messages
1
Reaction score
0
Help...

Hi...

I have a similar problem right now. I'm calling a stored procedure that was not build by me, and in the dbms_sql.execute, nothing happends...when called by my webservice.
If i call this procedure in a normal editor, without ado.net...it works.

You have solved your problem? can you help me...please
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top