SQLServer获取临时表所有列名或是否存在指定列名的方法

来自:网络
时间:2023-01-05
阅读:
免费资源网 - https://freexyz.cn/

获取临时表中所有列名

select name from tempdb.dbo.syscolumns where id=object_id( '#TempTB')

判断临时表中是否存在指定列名

if col_length('tempdb.dbo.#TempTB','columnName') is not null
  print '存在'
else
  print '不存在'

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!

免费资源网 - https://freexyz.cn/
返回顶部
顶部