SQL积累
1.
--查找数据库中哪些表拥有指定的列名 select OBJECT_NAME(id) from syscolumns where name ='ColumnName'
2.
--查找表中是否有完全重复的数据 DECLARE @allCount INT DECLARE @disCount INT SET @allCount = (SELECT COUNT(*)AS allCount FROM table) SELECT DISTINCT * INTO #temp FROM table SET @disCount = ( SELECT COUNT(*)AS disCount FROM #temp) DROP TABLE #temp IF(@allCount-@disCount>0) BEGIN PRINT 'Have complete same rows' END ELSE BEGIN PRINT 'No complete same rows' END
3.
--判断某表是否存在 if object_id('tableName') IS NOT null BEGIN --do what you want END