SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Stored Proc with SP_ prefix


Stored Proc with SP_ prefix

Author
Message
Ashesh
Ashesh
UDP Broadcaster
UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)

Group: General Forum Members
Points: 1439 Visits: 197
I completely agree with the fact that stored proc with the prefix "sp_" is reserved for system stored procs. However, the 2nd part is not correct.
If a stored procedure uses same name in both the user database and a system database, the stored procedure in the user database will never get executed.

To verify this I've executed the below code, which suggest irrespective of the prefix, it’s going to execute the proc which has been referred.
T-SQL Code
use master
drop proc dbo.sp_test
go
create proc dbo.sp_test
as
print 'SP from Master DB'
go
use AdventureWorks
go
drop proc dbo.sp_test
go
create proc dbo.sp_test
as
print 'SP from AdvWork DB'
go

exec dbo.sp_test



Result

SP from AdvWork DB



Thanks,
Ashesh


Thanks,
Ashesh

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search