Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Check the existency of table

Author  Topic 

batken
Starting Member

1 Post

Posted - 2006-03-20 : 02:13:42
Hi,

I can check the existency of the attribute in particular table. But is it possible for me to check whther my table is exist or not in that particular database?

I am using JSP

Please help!
thank you

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-03-20 : 02:28:38
Something like this ..

If Not Exists (Select * From Information_Schema.Tables Where Table_Name = '<Yours Table>')
Print 'Table Doesnt Exists'
Else
Print 'Table Exists'

Sucess Comes to those who Believe in Beauty of their Dream..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-20 : 03:07:31
or

if object_id('yourTable','table') is not null
print 'exists'
else
print 'not exists'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -