"; 1" after calling a stored procedure in MS SQL?

Doing some maintenance on an old report created by someone a long time ago. I noticed that the data source for the report is a stored procedure. The sproc call is as follows:

EXEC someStoredProc;1 

I have never seen "1" before. Just curious, what the hell is this? Unable to find documentation online. If I switch “1” to any other number, SQL throws an error “cannot find the stored procedure“ someStoredProc. ”But return it to“ 1 ”and it works. It does not seem to affect the output. What is this thing?

I noticed that I can put "; 1" after any stored procedure, and it looks, apparently, the same as without it.

If someone can clear this secret for me - thanks!

+5
source share
1 answer

They are known as Numbered Procedures , which have been deprecated since 2005 (but are still supported through SQL Server 2012 )

In SQL Server, you can create different versions of a stored procedure with the suffix ;# . Usually they can be used to overload the stored procedure by creating a different version that accepts a different number of parameters or behaves differently, etc.

+5
source

Source: https://habr.com/ru/post/1269810/


All Articles