sql - object_id() vs sys.objects -
I use the database script, where I check the existence of a stored procedure, then leave it and create it.
Which of the following SPs will be more efficient to check and leave?
if existing (SELECTobjects From * sysobjects WHERE OBJECT_ID = Obzecidid (n '[dbo]]. [Mysted prc]', n'p ') drop processor deb. Option 2
If OBJECIDID (NW Mistered Pro ', N'P') tap drop process Is dbo.myStoredProc; I have decided to use the second because of obvious reasons, is there any reason why I should be the first option
No, there are no compelling reasons to use sys.objects. As a matter of fact, the use of these sys ideas is being frustrated - so if you can avoid it, then do so!
Instead, the Information- SCHEMA schema idea should be used wherever possible - it is a standard SQL-92 to use the system (sys. * Views) to highlight metadata about your server. Instead of Microsoft-specific ways
Mark
Comments
Post a Comment