Cannnot execute Dynamic SQL inside stored procedure

  • Thread starter Thread starter Net
  • Start date Start date
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
 
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
 
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
 
Back
Top