Sunday, February 26, 2012

DROP A LIST OF TABLES

Hi all,
How can I delete a list of tables with SQL Script ?
Many thanks,
//HM
drop table tableName1, tableName2, tableName3 ...
regards krystian zieja / mob
Hicham wrote:
> Hi all,
> How can I delete a list of tables with SQL Script ?
> Many thanks,
> //HM
>
|||How can I declare table name as variale and use it in this script.
Drop table Txx
where xx is my variable.
Thanks
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||Hi,
Use the below script:-
declare @.tbl_names varchar(300)
set @.tbl_names='t1,t2,t3,t4'
exec('drop table '+@.tbl_names)
Thanks
Hari
MCDBA
"Hicham Mechmachi" <mechmachi@.hotmail.com> wrote in message
news:OyUPKOEREHA.556@.TK2MSFTNGP10.phx.gbl...
> How can I declare table name as variale and use it in this script.
> Drop table Txx
> where xx is my variable.
> Thanks
>
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!

No comments:

Post a Comment