sql语言中对数据库的表的判断

 
     Obtain the database list in sql server:
USE master
SELECT * FROM sysdatabases
Database name field: name
        Check whether an database object exists:
SELECT object_id(‘object name’)
SELECT object_id(n'name','U'/'V'/'tr')
Para U:Table  V:View Tr:trigger.
// check if there is a database xjaa.
USE master
IF DB_ID(N'name') IS NULL
BEGIN
 CREATE DATABASE name
END
Return the identification of the object or null if it doesn’t exist.
        Delete database object:
DROP TABLE <tablename>
DROP TRIGGER: <triggername>
DROP DATABASE: <databasename>
          Modify database object:
ALTER DATABASE:
ALTER TABLE:
ALTER PROCEDURE
ALTER TRIGGER

你可能感兴趣的:(sql,sql,数据库,object,server,database,语言)