Tuesday, October 7, 2008

Using TSQL Function: OBJECT_ID()

Many of you must have found the OBJECT_ID() function very handy. It is particularly helpful to check the existence of an object. SQL Server 2005 added a second optional parameter to specify the object type that helps you to check if the object is a table, procedure etc and can generate the drop statements accordingly. This function can also be used to check the existence of global and local temp tables. You can find a few interesting points about this function here: http://blog.sqlserver.me/2008/10/using-tsql-function-objectid.html

0 comments: