I browsed the web looking for a way to write the results from one of my stored procedures to a table. There were quite a few ways to do it, however this one worked best for me:
IF OBJECT_ID(N'tempdb..#Temp') IS NOT NULL BEGIN DROP TABLE #Temp END CREATE TABLE #Temp (Date_Flag [varchar](12) ,Account_Code [varchar](20) ,Calendar_Month [datetime] ,Last_Receipt_Month [date] ,Last_Receipt_Date [date] ,Last_Receipt_AMT [money]) INSERT INTO #Temp EXEC [Database].[dbo].[Procedure]; SELECT * FROM #Temp GO
I hope this helps.