Check how much technoledge do you have??
Enjoy The world of "Technoledge".
This blog is all about Technology.
Latest Tech-news, Tips & Tricks, Fun Stuffs for Internet, Computer, Site etc.
If you have something more technoledge, please share it with others by posting here.
If any one want to post an article on this site or he want authors rights please contact me at firstname.lastname@example.org.
Wednesday, June 5, 2013
SQL SERVER – Script to Update a Specific Column in Entire Database
In our database we have recently introduced ModifiedDate column in all of the tables. Now onwards any update happens in the row, we are updating current date and timeto that field.
Now here is the issue, when we added that field we did not update it with a default value because we were not sure when we will go live with the system so we let it be NULL. Now modification to the application went live yesterday and we are now updating this field.
Here is where I need your help. We need to update all the tables in our database where we have column created ModifiedDate and now want to update with currentdatetime. As our system is already live since yesterday there are several thousands of the rows which are already updated with real world value so we do not want to update those values. Essentially, in our entire database where ever there is a ModifiedDate column and if it is NULL we want to update that with current date time?