I am Working on SQL and I want to check if table exist in a database or not.
and also how can i check is specific field exist in table or not
Help plz
Printable View
I am Working on SQL and I want to check if table exist in a database or not.
and also how can i check is specific field exist in table or not
Help plz
I am assuming you are using SQL Server.
To check a TableTo check if a field exists in a TablePHP Code:Select count([NAME]) From SYSOBJECTS Where [NAME] = 'myTABLENAME'
PHP Code:Select Count(SYSCOLUMNS.[NAME]) From SYSCOLUMNS Inner Join SYSOBJECTS On SYSCOLUMNS.ID = SYSOBJECTS.ID Where SYSOBJECTS.[NAME] = 'myTableName' And SYSCOLUMNS.[NAME] = 'ColumnName'
Thanx :)
If you consider this resolved, would you please pull down the Thread Tools menu and click the Mark Thread Resolved menu item? That will let everyone know that you have your answer.
Thank you. :)