Clear all data in DB table

莫河
2023-12-01

USE database

 

--

DECLARE @SQL VARCHAR(8000)

SET @SQL = ''

SELECT @SQL = @SQL + 'DELETE FROM [' + [Name] + '];' + CHAR(10) FROM SYS.OBJECTS WHERE TYPE='u'

--

SET @SQL = @SQL + @SQL + @SQL

PRINT @SQL

BEGIN TRY

      EXEC(@SQL)

END TRY

BEGIN CATCH

END CATCH

 

 类似资料:

相关阅读

相关文章

相关问答