Monday, May 14, 2007

Determine if a table exist in SQL Mobile database.

If you wants to find out that whether a particular table exist in a SQL Mobile database, here is a simple solution.
Fire the following query from COmmand.ExecuteScalar.
SELECT count(*) FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME = @TableName

If it returns 1; it means the table exists in the database & if it returns 0 then it means the table doesn't exists.

No comments:

Post a Comment