本帖最后由 daniel0301 于 2009-06-16 15:43:55 编辑

解决方案 »

  1.   

    --获取identity列名称:  
    select name from syscolumns    
    where id=object_id('表名')  
    and autoval is not null        
                                             
    --当前标识信息  
    select ident_current('表名') as '当前标识值'  
    ,ident_seed('表名') as '种子'  
    ,ident_incr('表名') as '增量'   
      

  2.   

    判断有没有:
    定义一变量@count int
    select @count=count(*) from syscolumns where id=(select object_id('表名')) and autoval is not null
    if @count > 0
    --有
    else 
    --没有获取该列名字:
    select [name] from syscolumns where id=(select object_id('表名')) and autoval is not null