DECLARE @tableName NVARCHAR(50)
DECLARE @sql NVARCHAR(200)
 
DECLARE LangTable CURSOR FOR
SELECT name  FROM sys.tables
 
    OPEN LangTable
    FETCH NEXT FROM LangTable INTO @tableName
 
    WHILE @@FETCH_STATUS = 0
    BEGIN
 
    SET @sql = 'ALTER TABLE  '+@tableName+' ALTER COLUMN IsDelete bit NOT NULL'
    PRINT(@sql)
    --EXEC @sql
 
    FETCH NEXT FROM LangTable INTO @tableName
 
    END
 
CLOSE LangTable
DEALLOCATE LangTable
Last modification:September 28th, 2021 at 03:05 pm
坚持技术分享,您的支持将鼓励我继续创作!