zoukankan      html  css  js  c++  java
  • 查询当前库中包含某个字段并且包含自增的表

    查询当前库中包含某个字段并且包含自增的表

    -- use dbname
    --当前库中包含某个字段的表
    select top 1000 o.name as tablename,c.name as colname 
    from dbo.syscolumns c join sysobjects o on c.id=o.id 
    --and uid= USER_ID('dbo')
    where 1=1
    and c.name='col_name'
    and o.type='U' 
    order by o.name 
    
    
    --当前库中包含某个字段and Identity 的表
    select top 1000 o.name as tablename,c.name as colname 
    from dbo.syscolumns c join sysobjects o on c.id=o.id 
    --and uid= USER_ID('dbo')
    where 1=1
    and c.name='col_name'
    and o.type='U' 
    --order by o.name 
    and o.name  in (
    select tablename from (
    select  o.name as tablename,c.name as colname ,c.id,c.name
    ,CASE WHEN COLUMNPROPERTY(c.id, c.name, 'IsIdentity') = 1 THEN ''
                 ELSE ''
            END AS 标识 
    from dbo.syscolumns c join sysobjects o on c.id=o.id 
    --and uid= USER_ID('dbo')
    where 1=1
    --and c.name='userid'
    and o.type='U' 
    ) t where t.标识=''
    )
    order by o.name 
  • 相关阅读:
    cull/clip distance example
    Sutherland-Hodgeman多边形裁剪
    OpenCV 脸部跟踪(3)
    人脸识别中的Procruster analysis应用
    卡尔曼滤波的原理说明
    偏导数
    泊松分布E(X^2)
    抽奖概率
    卡尔曼滤波的原理说明
    卡尔曼滤波3
  • 原文地址:https://www.cnblogs.com/davidhou/p/6553137.html
Copyright © 2011-2022 走看看