I'm calling a stored procedure with named parameter.
exec MySP @name = 'binesh', @amount = @amt, @date = @date
It's working fine for me.
But when I'm trying
exec MySP2 @name = 'binesh', @amount = -@amt, @date = @date
or
exec MySP3 @name = 'binesh', @amount = @amt, @date = convert(varchar(25), @date, 131)
I get a syntax error.
Is this mandatory that I need to create separate variables for each (common sense tells it won't be the way). So what is the syntax for this?
Thanks all
Binesh
You can not construct input "in-line" for stored procedures. You must resolve the inputs prior to using them.
For example, you need to do something like this (as well as resolve the other parameters) ...
declare
@date varchar(25) = convert(varchar(25), @date, 131);
exec MySP3 @name = 'binesh', @amount = @amt, @date = @date;