emi_sastra
asked on
Delete Tables with Certain Condition
Hi All,
I want to delete (drop) tables with certain condition.
How could I do it?
Thank you.
I want to delete (drop) tables with certain condition.
How could I do it?
Thank you.
you can delete the data by using where clause..whar r u looking exactly??can you an example??
DELETE FROM customer
WHERE customer_name = 'IBM'
@shivkasi,
have you read Author's statement?
>>I want to delete (drop) tables with certain condition.<<
he want to drop table, not delete records. which could be done by the way I saw or this one:
have you read Author's statement?
>>I want to delete (drop) tables with certain condition.<<
he want to drop table, not delete records. which could be done by the way I saw or this one:
if exists(select 1 from TableName where Field1='SomeCondition')
begin
drop table tableName
end
else
begin
print 'can not drop'
end
try using bash/php, you can put conditions there
ASKER
Hi All,
I am sorry, it seems that my description was not clear enough.
Suppose in my database I have tables below:
1. THSJPOJUAL1003
2. THSJPOJUAL1050
3. so on..
I want to delete tables where its name not less than THSJPOJUAL2000.
How could I do it?
Thank you.
I am sorry, it seems that my description was not clear enough.
Suppose in my database I have tables below:
1. THSJPOJUAL1003
2. THSJPOJUAL1050
3. so on..
I want to delete tables where its name not less than THSJPOJUAL2000.
How could I do it?
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi lammy82,
That's great.
My problem is solved.
Thank you very much for your help.
That's great.
My problem is solved.
Thank you very much for your help.
set @d=5
if @d>0
begin
drop table tableName
end
else
begin
print 'can not drop'
end