I have a stored procedure in SQL 2005. The stored procedure actually creates temporary tables at the beginning of the SP and deletes them at the end. Now I am debugging SP in VS 2005. Between SP I would like to know the contents in a temporary table. Can anyone help while viewing the contents of the temporary table at runtime.
Thanks Vinod T
There are several types of temporary tables, I think you could use a table that is not discarded after the SP used it. Just make sure you don't call the same SP twice, or you get an error message trying to create an existing table. Or just release the temporary table after you see its contents. So instead of using a table variable ( @table) just use #tableor##table
@table
#table
##table
From http://arplis.com/temporary-tables-in-microsoft-sql-server/ :
, * (, ) .?
. , .
, temp, .
sp_select github.
, exec sp_select 'tempdb..#temp' , .
exec sp_select 'tempdb..#temp'
: Visual Studio Microsoft , SQL.
, #temp, ## temp , , .
: ... , Microsoft ... SQL .
, , SQL, , #temp.
.
SELECT * FROM #Name USE [TEMPDB] GO SELECT * FROM syscolumns WHERE id = ( SELECT id FROM sysobjects WHERE [Name] LIKE '#Name%')
, , :
-- Get rid of the table if it already exists if object_id('TempData') is not null drop table TempData select * into TempData from #TempTable