I have a stored procedure that accepts @date as a parameter. The sp fills a table with various data that is asscoaited with the date entered as a parameter. How would I go about putting in logic that if you enter the same date twice as a parameter it will delete all the rows that were previously associated with that date in the table and enter the new information for that date?
Right now if Run my stored procedure twice exec sp_test'09-12-2011' It will put the same data in twice. I need it to recognize that the date already exists in the table then delete all the rows associated with it. Then re-enter the new rows of that date.
I am not sure how to go about this. Does this make sense?
Before filling the table, your procedure needs a delete statement to empty the table of any information pertaining to the supplied date. Maybe something like
answered Dec 09, 2011 at 12:02 PM