|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 11:27 AM
Points: 1,407,
Visits: 2,020
|
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 11:21 AM
Points: 2,163,
Visits: 2,148
|
|
Great question, thanks Jason!
The old don't start your SP names with SP_
I really wish I knew all of this 13 years ago... ;)
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Yesterday @ 2:53 AM
Points: 1,526,
Visits: 359
|
|
thanks, great question... got it wrong though 
A user-defined stored procedure that has the same name as a system stored procedure and is either nonqualified or is in the dbo schema will never be executed; the system stored procedure will always execute instead.
i have read the microsoft link; was wondering if the user-defined proc doesn't ever run then what is the purpose of creating that proc ? why can't an error be thrown instead ?
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, September 14, 2010 8:24 AM
Points: 69,
Visits: 33
|
|
| Nailed it, because I assumed that "person" was not me. If I were "person" the answer would have been 5.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, September 14, 2010 8:24 AM
Points: 69,
Visits: 33
|
|
ziangij (6/8/2010)
thanks, great question... got it wrong though 
A user-defined stored procedure that has the same name as a system stored procedure and is either nonqualified or is in the dbo schema will never be executed; the system stored procedure will always execute instead.
i have read the microsoft link; was wondering if the user-defined proc doesn't ever run then what is the purpose of creating that proc ? why can't an error be thrown instead ?
1) the user defined proc can be run explicitly, perhaps in within an EXEC(string) used in a proc that built the command with the user name as argument. 2)Or if that particular user (joeFoo) runs sp_whatever, and his/her username is attached to another proc with the same name (joeFoo.sp_whatever), then THAT proc executes.
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Yesterday @ 3:21 AM
Points: 1,843,
Visits: 971
|
|
I got wrong.Thought that it will give error the sp_ ...... procedure already exists if the procedure name alreay in master database.
Malleswarareddy I.T.Analyst MCITP(70-451)
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 7:36 AM
Points: 2,716,
Visits: 981
|
|
forjonathanwilson (6/8/2010) Nailed it, because I assumed that "person" was not me. If I were "person" the answer would have been 5. Or if the default schema of the user executing it is person.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Monday, July 05, 2010 10:56 PM
Points: 230,
Visits: 17
|
|
| Avoiding uage of prefix sp_ improves the performance.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Friday, March 29, 2013 1:52 AM
Points: 118,
Visits: 166
|
|
Very Nice question
I am not sure but the query is returning me 5....
I dont have the AdventureWorks db on the server...
Tried using the test database with dbo schema.... may be this is why the results are different for me
Prashant Bhatt Sr Engineer - Application Programming
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 5:29 PM
Points: 6,367,
Visits: 8,226
|
|
|
|
|