This is a simple stored procedure written in SQL Server Management Studio.
It compiles great but I have problems invoking it :(
CREATE PROCEDURE [dbo].[DetermineVoltage]
@itemDescription varchar(225) ,
@voltageRating varchar(225) OUTPUT
AS
BEGIN
SELECT
@voltageRating = REVERSE(SUBSTRING(REVERSE(@itemDescription),
charindex(' V', REVERSE(@itemDescription)) + 2,
CHARINDEX(' ', REVERSE(@itemDescription), charindex(' V', REVERSE(@itemDescription)) + 1) - charindex(' V', REVERSE(@itemDescription)) - 2))
RETURN
END
In SQL Server Management Studio, when I execute this stored procedure like this:
DECLARE @voltageRating VARCHAR(225)
exec dbo.DetermineVoltage['test 20V', @voltageRating]
I get an error
Procedure or function 'DetermineVoltage' expects parameter '@voltageRating', which was not supplied.
There are many SO answers which discusses the same error message but when executed from a C# program.
But, in my case, how to execute a stored procedure within SQL Server Management Studio ?
declare @voltageRating varchar(225);
exec dbo.DetermineVoltage 'test 20V', @voltageRating output;
As a side note, you might want to convert this procedure to a function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With