Reputation: 567
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?
Upvotes: 0
Views: 674
Reputation: 122032
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;
Upvotes: 2