Author |
Topic |
GregDDDD
Posting Yak Master
120 Posts |
Posted - 2010-03-19 : 18:33:00
|
I'm kind of new to SQL Server development. Most of what I've done in the past has been with MS Access, or just querying a SQL Server. I designed a table in SQL Server 2000 that has 6 columns. I'm writing data to the table from a VB.Net app using OLEdb. I'm in testing mode, so I tried to delete all or some of the rows in the table from Enterprise Manager. There are only 12 rows and whether I try to delete one or all I get the following error. Any help is appreciated."Key column information was insufficient or incorrect. Too many rows were affected by update."Greg |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
GregDDDD
Posting Yak Master
120 Posts |
Posted - 2010-03-19 : 19:55:40
|
I had a feeling it was a PK issue, given the error message. It really doesn't apply to this table, but I suppose I could add a counter field. Does SQL Server have something like the "AutoNumber" field like Access. I tried "uniqueidentifier", hoping it would auto populate with a counter, but it didn't. I have a date/time field, but the first two rows are null and now I can't delete them. It won't let me set a PK. Should I just start over?Greg |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
GregDDDD
Posting Yak Master
120 Posts |
Posted - 2010-03-19 : 20:47:16
|
Thanks, I'll give it a try Monday. At 5 til 5 today I tried a quick delete query but SQL Server didn't like my Access syntax: DELTE * FROM tblFaxRoute |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-03-19 : 22:35:06
|
take out the *DELETE FROM tblFaxRouteIf you intend to delete every record, you can truncate the table:TRUNCATE TABLE tblFaxRoute |
|
|
GregDDDD
Posting Yak Master
120 Posts |
Posted - 2010-03-22 : 15:03:15
|
So the 'DELETE FROM tblFaxRoute' syntax worked and I was able to clear the table. However, the 'Identity' field property is grayed out. This got me to thinking about my permissions and I'm not even sure what login I'm using. On SQL Server 2005/08 I must login when I open Enterprise Manger. On SQL Server 2000 it does not prompt me for a login. Is it Windows Authentication? I created a login that I use from VB.Net code, but who am I from the Enterprise Manger?Greg |
|
|
GregDDDD
Posting Yak Master
120 Posts |
Posted - 2010-03-22 : 16:22:47
|
Oops, my bad. I was trying to make a 'uniqueidentity' field 'identity'. I deleted the field and created a new. I set that to 'identity' and it is working as expected. I can now delete rows from the Open Table view. Still, who am I logged in as when in Enterprise Manger? Is it sa? Greg |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|