Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

";1" after calling stored procedure in MS SQL? [duplicate]

Doing some maintenance on an old report created by someone long ago. I notice data source for the report is a stored procedure. The sproc call looks like this:

EXEC someStoredProc;1

I've never seen the ";1" before. Just curious what the heck it is? Can't find any documentation online. If I switch the "1" to any other number, SQL throws error "cannot find stored procedure 'someStoredProc'". But switch it back to "1" and it works. Doesn't seem to have any impact on output. What is this thing?

I noticed I can put ";1" after any stored procedure and it executes seemingly the same as without it.

If anyone can clear up this mystery for me - thank you!

like image 931
MrB Avatar asked Jul 13 '17 18:07

MrB


1 Answers

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

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

like image 78
Siyual Avatar answered Oct 05 '22 23:10

Siyual