Saturday, June 13, 2015

SQL server error : Could not find stored procedure

Msg 2812, Level 16, State 62, Procedure dummy_ins, Line 13
Could not find stored procedure 'insert into dummy values (1,ENCRYPTBYKEY(key_guid(@symmtric_key),'sdf')'.

I created stored procedure and was executing dynamic sql query in SP

set @temp_sql = 'insert into dummy values (' + @vid +','+ 'ENCRYPTBYKEY(key_guid(@symmtric_key),''' + @vname+ ''')'
print @temp_sql
exec  @temp_sql

Here i am using "exec @temp_sql", for sqlserver it is equivalent to call procedure, so why it is giving above error.

use keyword "sp_executeSQL" as see below:
exec sp_executeSQL @temp_sql

No comments:

Post a Comment

web stats