Search This Blog

Friday, March 1, 2013

EXEC() error : could not find stored procedure (SQLServer)

Solution:

EXEC with brackets.

use master;
go

DECLARE
 @sql                nvarchar(max)
set   
  @sql = 'select * from sysdatabases'
-- EXEC without brackets () generate  error
exec   @sql

-- EXEC with brackets success
exec   (@sql )