I have a stored procedure in my SQL Server that starts with these lines code:
CREATE PROCEDURE [dbo].[SP_Notify]
-- Add the parameters for the stored procedure here
@UserName nvarchar(50),
@lastDate datetime
AS
BEGIN
-- my code...
I try to call the stored procedure using this code:
DECLARE @data datetime
DECLARE @Username nvarchar(50)
SET @Username = CAST('myUserName' AS nvarchar(50))
SET @data = GetDate()
SP_Notify @Username , @data
but this causes this error:
Msg 102, Level 15, State 1, Line 10
Syntax error near ‘SP_Notify’.
use
exec SP_Notify @Username,@data