获取临时表中所有列名
select name from tempdb.dbo.syscolumns where id=object_id( '#TempTB')
判断临时表中是否存在指定列名
if col_length('tempdb.dbo.#TempTB','columnName') is not null print '存在' else print '不存在'
本文介绍在SQL Server中如何获取临时表的所有列名,以及如何判断临时表中是否存在特定列名的方法。通过示例代码展示具体实现过程。
获取临时表中所有列名
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://www.cnblogs.com/Tench/p/SQLServerGetTempTableColumnName.html
271
5038

被折叠的 条评论
为什么被折叠?