Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: SQL
Expertise: Beginner
May 4, 2005



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Using T-SQL to Check Whether a Table Exists

Assume that an application creates a new table every month. The table name can be coined using some pattern, like sales0501, sales0502,, etc.

To identify whether a particular table exists in a database, the following query can be used in the application:

"select name from sysobjects where xtype='u' and name = @tblName"
@tblName is the table name to be searched in the database and @tblName is the input parameter for the query.

Jaya Nehru Kumar
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date