Unix Technical Forum

WARNING. A simple cut and paste of 8 records can distroy a SQL Server table

This is a discussion on WARNING. A simple cut and paste of 8 records can distroy a SQL Server table within the SQL Server forums, part of the Microsoft SQL Server category; --> Today I need to copy 8 records in a table. I have to use Access 200 because of the ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 03:17 AM
pete
 
Posts: n/a
Default WARNING. A simple cut and paste of 8 records can distroy a SQL Server table

Today I need to copy 8 records in a table. I have to use Access 200 because
of the limitation of Enterprise Manager's inability to cope with field with
more than 900 characters. Selected records, cut, paste. I got an erroor
message about not being able to have a null Key_ID (I copied the reords and
tried to paste the Key_ID as part of the records - normally I hide the
Key_ID).
Now I can't access either the new records or the originals that I was trying
to copy (because, it would seem, they have identical primary keys). I also
cannot export the table via DTS 'unspecified error' and 'integrity
violation'.
Or delete the offending records with a Query Anaylyser delete query.
Basically the entire SQL Server database has been destroyed with a couple of
keystrokes.
Now, I've being developing database applications for over 20years and the
one thing, maybe the only thing I expect from a database server is to
protect the integrity of my data. SQL Server does not, it would seem. These
records aren't just any random unimportant records either. They contain the
'create views' that my entire application require to function and each one
approaches the 8000 record limit and have take years to perfect and just
checking that the table is valid could take me days.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 03:17 AM
SWu
 
Posts: n/a
Default Re: WARNING. A simple cut and paste of 8 records can distroy a SQL Server table

sorry if this sounds like a couple of dumb, obvious questions:
- do you have backups of this important code?
- are you able to drop the constraints on the table, remove the offending
records and reapply the constraints?

regards,
stephen
"pete" <pete@madpete.freeserve.co.uk> wrote in message
news:40d2c64e$0$4584$db0fefd9@news.zen.co.uk...
> Today I need to copy 8 records in a table. I have to use Access 200

because
> of the limitation of Enterprise Manager's inability to cope with field

with
> more than 900 characters. Selected records, cut, paste. I got an erroor
> message about not being able to have a null Key_ID (I copied the reords

and
> tried to paste the Key_ID as part of the records - normally I hide the
> Key_ID).
> Now I can't access either the new records or the originals that I was

trying
> to copy (because, it would seem, they have identical primary keys). I also
> cannot export the table via DTS 'unspecified error' and 'integrity
> violation'.
> Or delete the offending records with a Query Anaylyser delete query.
> Basically the entire SQL Server database has been destroyed with a couple

of
> keystrokes.
> Now, I've being developing database applications for over 20years and the
> one thing, maybe the only thing I expect from a database server is to
> protect the integrity of my data. SQL Server does not, it would seem.

These
> records aren't just any random unimportant records either. They contain

the
> 'create views' that my entire application require to function and each one
> approaches the 8000 record limit and have take years to perfect and just
> checking that the table is valid could take me days.
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 03:17 AM
pete
 
Posts: n/a
Default Re: WARNING. A simple cut and paste of 8 records can distroy a SQL Server table

Yes I have a backup from yesterday, but it was a 14hour day and I don't ever
want to reapeat it.. But your sugguestion about removing the constraint
helped, I could delete them. Thanks.

"SWu" <sw@rgrzz.com.au> wrote in message
news:uu3pgQSVEHA.1888@TK2MSFTNGP11.phx.gbl...
> sorry if this sounds like a couple of dumb, obvious questions:
> - do you have backups of this important code?
> - are you able to drop the constraints on the table, remove the offending
> records and reapply the constraints?
>
> regards,
> stephen
> "pete" <pete@madpete.freeserve.co.uk> wrote in message
> news:40d2c64e$0$4584$db0fefd9@news.zen.co.uk...
> > Today I need to copy 8 records in a table. I have to use Access 200

> because
> > of the limitation of Enterprise Manager's inability to cope with field

> with
> > more than 900 characters. Selected records, cut, paste. I got an erroor
> > message about not being able to have a null Key_ID (I copied the reords

> and
> > tried to paste the Key_ID as part of the records - normally I hide the
> > Key_ID).
> > Now I can't access either the new records or the originals that I was

> trying
> > to copy (because, it would seem, they have identical primary keys). I

also
> > cannot export the table via DTS 'unspecified error' and 'integrity
> > violation'.
> > Or delete the offending records with a Query Anaylyser delete query.
> > Basically the entire SQL Server database has been destroyed with a

couple
> of
> > keystrokes.
> > Now, I've being developing database applications for over 20years and

the
> > one thing, maybe the only thing I expect from a database server is to
> > protect the integrity of my data. SQL Server does not, it would seem.

> These
> > records aren't just any random unimportant records either. They contain

> the
> > 'create views' that my entire application require to function and each

one
> > approaches the 8000 record limit and have take years to perfect and just
> > checking that the table is valid could take me days.
> >
> >

>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 03:17 AM
Erland Sommarskog
 
Posts: n/a
Default Re: WARNING. A simple cut and paste of 8 records can distroy a SQL Server table

pete (pete@madpete.freeserve.co.uk) writes:
> Today I need to copy 8 records in a table. I have to use Access 200
> because of the limitation of Enterprise Manager's inability to cope with
> field with more than 900 characters. Selected records, cut, paste. I
> got an erroor message about not being able to have a null Key_ID (I
> copied the reords and tried to paste the Key_ID as part of the records -
> normally I hide the Key_ID).
>
> Now I can't access either the new records or the originals that I was
> trying to copy (because, it would seem, they have identical primary
> keys). I also cannot export the table via DTS 'unspecified error' and
> 'integrity violation'.
> Or delete the offending records with a Query Anaylyser delete query.
> Basically the entire SQL Server database has been destroyed with a
> couple of keystrokes.
> Now, I've being developing database applications for over 20years and the
> one thing, maybe the only thing I expect from a database server is to
> protect the integrity of my data. SQL Server does not, it would seem.


SQL Server protects the integrity of your data, as far as you tell it
what to protect. It cannot make random guesses.

In any case, it is impossible to tell what happened, since you also
involved Access. "Cut and paste" is not a concept that exists in
SQL Server proper. If Access implemented the cut-and-paste with a
DELETE and INSERT, and the INSERT failed, and did not use a transaction,
then SQL Server have to plead innocent.

> These records aren't just any random unimportant records either. They
> contain the 'create views' that my entire application require to
> function and each one approaches the 8000 record limit and have take
> years to perfect and just checking that the table is valid could take me
> days.


It seems a little funny to me that you store source code in a database
table. I would use a version-control system.

But assuming that you had created the views, you can use sp_helptext
to get SQL Server's version of the views. There are also scripting
facilities in Enterprise Manager.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-29-2008, 03:18 AM
Beeeeeves
 
Posts: n/a
Default Re: WARNING. A simple cut and paste of 8 records can distroy a SQL Server table

If you have a field name of more than 900 characters, then its your own
silly fault.
On the other hand it could be that you had a unique index on that was
created with(nocheck), which would explain why you could delete records, but
couldn't put them back in again.

"pete" <pete@madpete.freeserve.co.uk> wrote in message
news:40d2c64e$0$4584$db0fefd9@news.zen.co.uk...
> Today I need to copy 8 records in a table. I have to use Access 200

because
> of the limitation of Enterprise Manager's inability to cope with field

with
> more than 900 characters. Selected records, cut, paste. I got an erroor
> message about not being able to have a null Key_ID (I copied the reords

and
> tried to paste the Key_ID as part of the records - normally I hide the
> Key_ID).
> Now I can't access either the new records or the originals that I was

trying
> to copy (because, it would seem, they have identical primary keys). I also
> cannot export the table via DTS 'unspecified error' and 'integrity
> violation'.
> Or delete the offending records with a Query Anaylyser delete query.
> Basically the entire SQL Server database has been destroyed with a couple

of
> keystrokes.
> Now, I've being developing database applications for over 20years and the
> one thing, maybe the only thing I expect from a database server is to
> protect the integrity of my data. SQL Server does not, it would seem.

These
> records aren't just any random unimportant records either. They contain

the
> 'create views' that my entire application require to function and each one
> approaches the 8000 record limit and have take years to perfect and just
> checking that the table is valid could take me days.
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-29-2008, 03:18 AM
Erland Sommarskog
 
Posts: n/a
Default Re: WARNING. A simple cut and paste of 8 records can distroy a SQL Server table

Beeeeeves (beeeeeeeeev@ves) writes:
> On the other hand it could be that you had a unique index on that was
> created with(nocheck), which would explain why you could delete records,
> but couldn't put them back in again.


There is NOCHECK for indexes. You can say NOCHECK with UNIQUE and PRIMARY
KEY constraints, but it does not have any effect. NOCHECK only applies
to CHECK and FOREIGN KEY constraints.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:59 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com