0

I have this stored procedure with out parameter (code):

SELECT code = RIGHT(CONCAT(REPEAT(0, 6), (SELECT MAX(CONVERT(code, int)) + 1 FROM enterprises)), 6)

If I exec it, return null value, but if I execute the single query, it works right. Why?

1
  • Can you show full procedure? Commented Apr 7, 2017 at 15:02

1 Answer 1

2

Rename parameter, try to write something like this (parameter name code_param) -

SELECT
  RIGHT(CONCAT(REPEAT(0, 6), (SELECT MAX(CONVERT(code, int)) + 1 FROM enterprises)), 6)
INTO code_param;
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.