How to run the sql scripts only once ?
For eg. If a table has 1 lakh records. If i run the script it will update the 1 lakh records. Now, if i run the script again it should not execute becouse it was already executed and also the table should not update? please help
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Nilesh ShahRank #42 · 34.2K reputationPosted Aug 9, 2017, 5:10 AM EDT
by default there is no statement/mechanism in SQL server which can do this.
let's say you want to execute only once in 24 hours, then you can have a table which store last timestamp when thequery was executed. in your query in very first line you chech this table, if that timestamp is less than 24 hours then query exits without doing anything.
Gokhul VarmanRank #1,505 · 1.1K reputationPosted Aug 9, 2017, 4:49 AM EDT