本文介绍了在 SQL Server 2005/2008 中创建一个类似于当前表的临时表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在存储过程中创建与当前表完全相同的临时表?

How do you create a temporary table exactly like a current table in a stored procedure?

推荐答案

select * into #temp_table from current_table_in_stored_procedure

#temp_table - locally temp
##temp_table - globally temp

select top 0 * into #temp_table from current_table_in_stored_procedure to have empty table

这篇关于在 SQL Server 2005/2008 中创建一个类似于当前表的临时表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 15:06