復(fù)制代碼 代碼如下:
--相信大家肯定經(jīng)常會(huì)把數(shù)據(jù)導(dǎo)入到數(shù)據(jù)庫中,但是可能會(huì)有些記錄行的所有列的數(shù)據(jù)是null,這為null的數(shù)據(jù)是我們不需要
--現(xiàn)在需要一個(gè)簡單的查詢來剔除掉這些為null的記錄行。
--假設(shè)表名為 emplyees
--方法1.
---先把數(shù)據(jù)導(dǎo)入到數(shù)據(jù)庫
---其次:
select * from sys.columns
where object_id =(select object_id from sys.objects where)
---方法2
---使用數(shù)據(jù)庫提供的函數(shù)
exec sp_columns 'Employees'
delete from Employees where coalesce(status,tel,gwei,ADDRESS1,address2,nwei) is null
新聞熱點(diǎn)
疑難解答
圖片精選