As a follow-up to my previous question I would like to know if there is a simple way of doing the following (which doesn't compile):
CREATE TABLE #PV ([ID] INT, [Date] DATETIME, Dis FLOAT, Del Float, Sold Float)
INSERT #PV @ID, exec GetPVSummaryReport @ID, @PID, @From, @To
The reason is I need to join #PV onto another table by [ID], but the original stored procedure doesn't have the necessary parameter.
Updating the SP is difficult (not impossible) as the code is 'out-in-the-wild' and I'd prefer not to have 'GetPVSummaryReport2' (which we already have several of already).
From stackoverflow
-
CREATE TABLE #PV ([Date] DATETIME, Dis FLOAT, Del Float, Sold Float) INSERT #PV EXECUTE GetPVSummaryReport @ID, @PID, @From, @To SELECT @ID as [ID], * FROM #PVOr
CREATE TABLE #PV ([ID] INT NULL, [Date] DATETIME, Dis FLOAT, Del Float, Sold Float) INSERT #PV ([Date], Dis, Del, Sold) EXECUTE GetPVSummaryReport @ID, @PID, @From, @To UPDATE #PV SET [ID] = @ID SELECT * FROM #PVgraham.reeds : I was so focused on getting the table into via insert I didn't consider the use of update!Mitch Wheat : +1. I missed that!
0 comments:
Post a Comment