|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Wednesday, January 02, 2013 12:15 PM
Points: 1,443,
Visits: 711
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 12:39 PM
Points: 5,103,
Visits: 20,220
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, February 22, 2012 11:15 PM
Points: 130,
Visits: 404
|
|
| The results could depend on the existence of database test2...
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Saturday, May 18, 2013 11:44 PM
Points: 1,216,
Visits: 297
|
|
A basic question but SQL script is poor. Though my answer was correct. But I cannot deny bits of fire from folks 
--Sudhir
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, October 13, 2011 12:44 AM
Points: 18,
Visits: 30
|
|
Important If any user-created stored procedure has the same name as a system stored procedure, the user-created stored procedure will never be executed. (from Microsoft)
then how it executes test2 sp instead of master db
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 3:15 AM
Points: 1,476,
Visits: 1,943
|
|
So BOL is wrong. From the link
It is strongly recommended that you do not create any stored procedures using sp_ as a prefix. SQL Server always looks for a stored procedure beginning with sp_ in this order:
The stored procedure in the master database.
The stored procedure based on any qualifiers provided (database name or owner).
The stored procedure using dbo as the owner, if one is not specified.
Because running the example it most definatly runs the SP in the current database before the master database.
/T
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, August 23, 2011 3:03 AM
Points: 1,
Visits: 5
|
|
From the Microsoft linked article, the master db gets searched first, so the version of the sp in there will run, correct? So either the answer to this question is wrong, or the MS documentation is wrong. Anyone sitting in front of an SQL server able to test this?
Of course anyone stupid enough to name their procs sp_ and fail to specify the db when execing deserves the uncertainties they get!
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, October 13, 2011 12:44 AM
Points: 18,
Visits: 30
|
|
| MS documentation is wrong as i tried and it exectue test2 DB sp instead of master db sp , but micrsoft says that it should first search in master db and it would run master db sp but here its behavior is different . unable to understand what's wrong with microsft
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Monday, May 06, 2013 3:27 AM
Points: 1,864,
Visits: 297
|
|
In SQL 2008 the script return 'that'. But the link point to an SQL 2000 document. Behavior might have changed...
Wait! Doesn't that mean, the answer 'that' is wrong, since it does not comply to the information provided by the linked document? I want my point back
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 1:47 AM
Points: 778,
Visits: 1,047
|
|
The answer is syntax error why should we assume the database test2 exist when it does not?
“When I hear somebody sigh, ‘Life is hard,’ I am always tempted to ask, ‘Compared to what?’” - Sydney Harris
|
|
|
|