1

I've made some code in sql server to get random float numbers. It pass rage and out a number, but it shows syntax error. Can someone show me, where it is and how I shoul correct it? That's my code

    CREATE PROCEDURE getAmount( @MinVal float, 
        @MaxVal float)
        @out float OUTPUT
        AS
        SELECT @out = ((@MaxVal - @MinVal)
        * RAND() + @MinVal)
        RETURN
1
  • Answer is already given. One suggestion use "SET NOCOUNT ON" and keep all the keywords in uppercase. Commented Mar 9, 2015 at 8:42

1 Answer 1

1

The OUT paramater needs to be inside the parenthesis;

CREATE PROCEDURE getAmount( @MinVal float, 
        @MaxVal float,
        @out float OUTPUT )
        AS
        SELECT @out = ((@MaxVal - @MinVal)
        * RAND() + @MinVal)
        RETURN
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.