select c.name from syscolumns a join systypes b on a.xtype=b.xtype join sysobjects c on a.id=c.id and b.name in('datetime','smalldatetime')
where c.xtype='u'

解决方案 »

  1.   

    所有表?SELECT 
        表名 = d.name
    FROM 
        syscolumns a
    left join 
        systypes b 
    on 
        a.xusertype=b.xusertype
    inner join 
        sysobjects d 
    on 
        a.id=d.id  and d.xtype='U' and  d.name<>'dtproperties'
    where b.name = 'datetime'
      

  2.   

    SELECT 
        表名 = d.name
    FROM 
        syscolumns a
    left join 
        systypes b 
    on 
        a.xusertype=b.xusertype
    inner join 
        sysobjects d 
    on 
        a.id=d.id  and d.xtype='U' and  d.name<>'dtproperties'
    where b.name = 'datetime' or b.name = 'smalldatetime'
      

  3.   

    select distinct  object_name(id) from syscolumns where xtype in (58,61)
      

  4.   


    select s.name from sysobjects s
    inner join syscolumns c on c.id = s.id
    inner join systypes b on c.xusertype=b.xusertype
    where s.xtype = 'u'
    and b.name ='datetime'