question

Barbara Plume avatar image
Barbara Plume asked

data loss following table script

In SQL2000, we created a script to make structure changes to 21 production tables while preserving their data by doing a drop and recreate. After running the script, we checked the tables in Enterprise Manager and noticed that 3 of the 21 tables had been partially truncated, i.e., of 54,311 rows, we saw 54,000. Have any of you ever noticed a similar occurrence? Thanks

maintenance
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

CirqueDeSQLeil avatar image
CirqueDeSQLeil answered

Yes, depending on the criteria in the script. I recommend to always make a backup of the table before making changes to its structure. I also recommend that a good backup of the database always be present.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image
Grant Fritchey answered

Not without an accompanying error of some sort. Did you run into any problems with the update? I haven't seen SQL Server simply drop data within properly configured scripts, no.

And I agree, backups should be taken prior to structural changes on a production system.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

TimothyAWiseman avatar image TimothyAWiseman commented ·
I have never heard of anything like this, but I will second the suggestion to always take a backup before doing any structural changes.
0 Likes 0 ·
Blackhawk-17 avatar image
Blackhawk-17 answered

Do you have a backup that you can check for duplicates on? Depending on your script they could have been eliminated.

Or perhaps you recreated the tables with indexes that excluded the rows for insertion?

How about triggers rejecting the rows?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.