CREATE TABLE XXX  

 [ID] [int] IDENTITY (1, 1) NOT NULL , 
 [MID] [int] NULL, 
)

解决方案 »

  1.   

    查询分析器里有模板..按两下鼠标就行了.-- =============================================
    -- Create table basic template
    -- =============================================
    IF EXISTS(SELECT name 
      FROM   sysobjects 
      WHERE  name = N'<table_name, sysname, test_table>' 
      AND   type = 'U')
        DROP TABLE <table_name, sysname, test_table>
    GOCREATE TABLE <table_name, sysname, test_table> (
    <column_1, sysname, c1> <datatype_for_column_1, , int> NULL, 
    <column_2, sysname, c2> <datatype_for_column_2, , int> NOT NULL)
    GO
      

  2.   


    if object_id('t') is null
    create table t
      

  3.   


    if object_id('tb')is null
    create table tb(..............)
    是这样吗?
      

  4.   

    if object_id('xxx', 'U') is not null
    begin
    CREATE TABLE XXX  

     [ID] [int] IDENTITY (1, 1) NOT NULL , 
     [MID] [int] NULL, 
    )
    end
      

  5.   

    if object_id('xxx', 'U') is null