alter table aaa
   drop constraint aaaa
goif exists (select 1
            from  sysobjects
           where  id = '1'
            and   type = 'V')
   drop view VW_aaa
gocreate table bbbb(
   CID                  int                  identity,
   RID                  int                  null,)
go应该转成 PROCEDURE 还是 FUNCTION  还是什么别的合适呢? 具体怎么转?
最好说下原因

解决方案 »

  1.   

    alter table aaa 
      drop constraint aaaa ;if exists (select 1 
                from  sysobjects 
              where  id = '1' 
                and  type = 'V') 

      drop view VW_aaa ; --直接drop
    create table bbbb( 
      CID                  int                  identity, 
      RID                  int                  null
    );--以上代码直接执行就OK了
      

  2.   

    create table bbbb( 
      CID  int ,  -- 此处identity去掉,用考虑trigger+sequence实现
      RID  int  null 
    );