Determines whether a database field exists and database Field
This article is based on the software of calligraphy and painting novels. The published content has nothing to do with this software.More comfortable reading, more comfortable writing, and easier Publishing
-- Determine whether if exists (select 1 from master .. sysdatabases where name = 'testdb') print 'testdb has 'else print 'testdb doesn't exist' -- determine whether the table exists if exists (select * from TestDB .. syscolumns where id = object_id ('testdb. dbo. testTb ') print' table TestTb has 'else print' table TestTb does not exist '-- determine whether the [Name] field if exists (select * from TestDB .. syscolumns where id = object_id ('testdb. dbo. testtb') and name = 'name') print 'field Name exists in 'else' field Name does not exist'
The software of calligraphy and painting novels is more comfortable to read, more comfortable to write, and easier to publish.