I am looking to generate a table off of updated records.
Example:
3 people are about to run a race. Get that data
SELECT person_id FROM person WHERE date_complete IS NULL
3 people finish the race today.
UPDATE person SET date_complete = today() and last_update = now() WHERE date_complete IS NULL
I am running this within a stored procedure and I am able to update and get the records on the fly. However, this is my problem: but the temporary table exists only for the duration of the stored procedure that creates it.
So basically I was wondering what would be the best way to populate a table with these records that were updated. I would need to see the records when this update is run and then possibly 5-10 minutes down the line. Thanks!
Can't you just populate a permanent table on the database instead of a temp table?
Jim
P.S. This is a MS SQL Server Forum so you may need to get advice elsewhere.
Everyday I learn something that somebody else already knew
I thought about creating a permanent table but didn't know if I wanted the extra table floating around just for this one program. Is it bad practice to create a table then drop/delete table every time this would be run?
Basically these updated records will only need to be known/populated for about 10 minutes after this is run.
It's still a table that is getting used regularly and read from different sources, so I'd just create it permanently and then add TRUNCATE TABLE myTable INSERT INTO myTable ...
Jim
Everyday I learn something that somebody else already knew