问题
Could you suggest please how to execute from Sql Server a stored procedure that receives an input parameter? I tried this but it failed:
EXEC GetFilmsInCategory('SF');
The stored procedure is correctly defined, by the way. I executed it from the visual interface and it worked, with this code generated automatically:
DECLARE @return_value int
EXEC @return_value = [dbo].[GetFilmsInCategory] @CatNume = N'SF'
SELECT 'Return Value' = @return_value
I find this automatically generated code too... lengthy as I was expecting something similar to what I initially tried:
EXEC GetFilmsInCategory('SF');
Can you fix this or offer an alternative? Thank you!
Anna
回答1:
TRY:
EXEC GetFilmsInCategory 'SF'
回答2:
You can also address the parameters by name:
EXEC GetFilmsInCategory @CatNume = 'SF'
来源:https://stackoverflow.com/questions/10806397/execute-sql-server-stored-procedure-with-input-parameter