Can we have multiple versions of Single Stored Procedure at the same time?
Yes, is is possible.This feature is very handy in deploying changes in existing Stored Procedure.Creation of Multiple versions for a Single Stored Procedure is possible by suffixing “;” followed by version number at the end of CREATE PROC STATEMENT.
Ex:
Create proc multi_version_sp (;1 default)
As
….
….
Create proc multi_version_sp (; 2 )
As
….
….
Create proc multi_version_sp (; n )
As
….
….
Executing Particular version:
Exec multi_version_sp invokes version 1 by default
Exec multi_version_sp ;2 invokes version 2
P.S: Dropping the first version of SP drops all versions.
No comments:
Post a Comment