This blog has personalition features for you, the reader. Below is a key of what all the icons mean and which aspects of the layout they change.
Close Window
IF (OBJECT_ID('objectname') IS NOT NULL) drop proc/table/etc objectnameGO
Friday, March 09, 2007 1:56 PM
Roy, Dumb question... SQL Server 2005 handles a drop like IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE SPECIFIC_SCHEMA = N'<Schema_Name, sysname, Schema_Name>' AND SPECIFIC_NAME = N'<Procedure_Name, sysname, Procedure_Name>' ) DROP PROCEDURE <Schema_Name, sysname, Schema_Name>.<Procedure_Name, sysname, Procedure_Name>GOby Default. How is you example figuring out the correct object to drop just by name? Is Object_ID in your example a built in function?Thanks,Dennis
yeah, it's a built in function. you can also feed it an optional parameter that will give you that object type. bol has good info on that function.from what i can tell, this method is faster than the existence check as well. i'll blog about it.
Fields denoted with a "*" are required.