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
 Query output

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-12-01 : 04:51:22
Dear All,
I need to write a procedure that needs to check for existence of some 50 tables and queried to contain more than zero records also a success code should be returned on success if not failure code.

Please help me in this regard,i am new to SQL programming.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-01 : 07:37:13

Why do you want to do this?

Madhivanan

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

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-12-01 : 08:20:38
As some of the tables are created dynamically need to ensure all the tables are present in order to proceed with the next step there i will be referencing to these tables.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-01 : 08:23:33
quote:
Originally posted by gangadhara.ms

As some of the tables are created dynamically need to ensure all the tables are present in order to proceed with the next step there i will be referencing to these tables.


This seems to be a bad design
To check the existance of the tables, use

if
object_id('table_name1') is not null and
object_id('table_name2') is not null and
.
.


Madhivanan

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

- Advertisement -