I have a temp table that needs the values of a Stored procedure. So the SP inserts 3 columns into the temp table, then I want to add a datetime to every row without modifying the SP.
Since I call 3 times the SP each with a different datetime, I can't just update the whole temp table.
Any Suggestions?
DECLARE @temp TABLE ( id INT IDENTITY(1,1), Name VARCHAR(150), Address VARCHAR(25), Date DATETIME )
WHILE (@count>=@daysBack)
BEGIN
SET @date=DATEADD(dd, @count, GETDATE())
INSERT INTO @temp (Name,Address)
EXEC[dbo].StoredProc@date
--I Want to check for Null and insert the date there
Update @temp SET Date=@date WHERE Date=''
SET @count=@count-1