|
-
Apr 12th, 2000, 05:01 AM
#1
Thread Starter
Addicted Member
I can not delete a record in a SQL server table. I did an insert into the table using VB. I inserted this record 4 times into the Table. I can delete other records in this table but not the ones I inserted in. The error I get is as follows:
Key Column information is insufficient or incorrect. To many rows were affected by update.
I have tried running the SQL Query analizer and used the following code
Delete From tTable
Where AcctNum = "The Account Number"
It returns and says successful but the records are still there????
-
Apr 12th, 2000, 10:20 PM
#2
Guru
Do you have a primary key on that table?
-
Apr 12th, 2000, 10:43 PM
#3
Thread Starter
Addicted Member
No I do not have a primary key.
-
Apr 12th, 2000, 11:26 PM
#4
You don't have to use From clause.
Try something like this:
Delete tTable Where AcctNum = 1
or whatever number you have there.
-
Apr 12th, 2000, 11:27 PM
#5
Frenzied Member
1) try :
select * from tTable insert into ##tempTable Where AcctNum not = "The Account Number"
2) if that works, then:
delete from tTable
3) Followed by:
insert into tTable select * from ##tempTable.
4) If all the above works, get rid of the temp table
drop ##tempTable
You will need to be logged on as sa. Make sure every step works to your liking, before proceding to the next step.
-
Apr 13th, 2000, 12:05 AM
#6
Thread Starter
Addicted Member
I tried both scenerios and it still did not work?????
-
Apr 13th, 2000, 12:34 AM
#7
Frenzied Member
Have your DBA run DBCC on your server, it sounds like there are problems with it.
-
Apr 13th, 2000, 12:36 AM
#8
Thread Starter
Addicted Member
Thanks. I will see what he can do.
-
Apr 13th, 2000, 09:39 PM
#9
Guru
Add an autonumber primary key to your table. Then delete where primary key = value
-
Apr 16th, 2000, 09:22 PM
#10
Thread Starter
Addicted Member
Thanks Clunietp. I added an Identity number and then I made it the primary key. I then was able to delete them!!!!!!!!!!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|