declare @FieldName VARCHAR(50) declare @TableName VARCHAR(50) = 'GWW_BM_T_IndustrialSource' declare B_Cursor1 cursor for SELECT a.name FROM sys.columns a JOIN sys.types b ON b.user_type_id = a.user_type_id WHERE a.object_id = OBJECT_ID(@TableName) ?? ??? ??? ?open B_Cursor1; ?? ??? ? ? ?FETCH next from B_Cursor1 into @FieldName?? ? ?? ? ? ? ? ?WHILE @@FETCH_STATUS =0? ?? ??? ??? ?begin ?? ??? ? ? ? ? EXEC('UPDATE '+@TableName+' SET '+@FieldName+' = NULL WHERE CAST('+@FieldName+' AS VARCHAR(50)) = ''--'' ') ?? ??? ??? ??? ?fetch next from B_Cursor1 into @FieldName ?? ??? ??? ?end ? ? CLOSE B_Cursor1; ? ? DEALLOCATE B_Cursor1; ?
|