Showing posts with label Pinal Dave. Show all posts
Showing posts with label Pinal Dave. Show all posts

Monday, June 10, 2013

SQL SERVER – DBCC RESEED Table Identity Value – Reset Table Identity

Hi Guys,

Today I faced an issue, when I migrated data from 1 DB to another DB using simple insert queries on cross DBs via SQL Server Management Studio. The identity column created an issue for my case here. Then I realized to truncate table and start inserting new records, which leads me to a surprise of "IDENTITY NOT GETTING RESET" with new records.

Then, my surf starts and finally Mr. Pinal Dave answered me with his fantastic blog post here. Which taught me a good thing today of RESEEDING Table Identity Value.

I am writing this article just to share this to all my blog lovers & friends, so that this may help you, too.

Hope this will help all my friends,

Update:
Guys, I have also written another article on this topic here. May this also help you out.

Thanks,
Vihang Shah.

Wednesday, June 5, 2013

SQL SERVER – Script to Update a Specific Column in Entire Database

“Pinal,
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? 
Do you have a script for it?”
For reply read here...

Thursday, December 20, 2012

SQL SERVER – Select and Delete Duplicate Records

Developers often face situations when they find their column have duplicate records and they want to delete it. A good developer will never delete any data without observing it and making sure that what is being deleted is the absolutely fine to delete. Before deleting duplicate data, one should select it and see if the data is really duplicate.

A very nice post & video. Read more here.

Find a cool free stuff everyday

Giveaway of the Day

Hiren Bharadwa's Posts

DotNetJalps