-- ============================================= -- Description: <检查指定表是否存在> -- ============================================= Create PROCEDURE up_TableExists @tableName nvarchar(50) AS BEGIN declare @sql nvarchar(max); set @sql = 'select COUNT(*) from sysobjects where id=object_id(N''' + @tableName + ''') and OBJECTPROPERTY(id,N''IsUserTable'')=1'; print @sql exec(@sql) END GO
c#调用这个存储过程,返回1则存在,返回0则表不存在