Hi,
I am trying to write the code using c#. Needed code to check whether the particulare data table from a database is exist or not. If not then create the table.
Please help me.
Hi,
I am trying to write the code using c#. Needed code to check whether the particulare data table from a database is exist or not. If not then create the table.
Please help me.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Len La Sala20 reputationPosted Feb 9, 2009, 12:06 PM EST
For SQL Server try this, it works for me, I found it at http://sqlserver2000.databases.aspfaq.com/how-do-i-determine-if-a-table-exists-in-a-sql-server-database.html
IF EXISTS (SELECT 1
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
AND TABLE_NAME='tablename')
SELECT 'tablename exists.'
ELSE
SELECT 'tablename does not exist.'