-
How to skip steps in SQL code
Hi,
I have a SQL code where there are steps like creation of table follwed by delete data from the table. For the first time when we run the code, the create table runs well. For the second time if the table in the create script already exist how do we check that and skip that statement to go to the next step which is DELETE step.
For eg:
Create table x;
delete x;
IF table x already exists what should be done to check if it already exist and go to the next DELETE step.
Thanks,
Saran.
-
Try something like:
IF OBJECT_ID('table x') IS NULL
Create table x
Else
....
-
Thank u.
Does Null mean the table does not contain data or the table is not present?
My question is if the table is not present create else go to next step. Its not about the data present in table. Help me out on this.
Thanks,
Saran.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|