Avatar of emi_sastra
emi_sastra

asked on 

Delete table with year and month

Hi All,

I try to delete table data. Please see below :

WHILE ( @IntMonth <= 12)
BEGIN
    DELETE FROM 'TDJURNAL' + ' + @Year + ' + @IntMonth

      SET @IntMonth = @IntMonth + 1
END

For example table name TDJURNAL201701 to 201712.

How could I do it ?

Thank you.
Microsoft SQL Server

Avatar of undefined
Last Comment
emi_sastra

8/22/2022 - Mon