You are here: Re: Strange issue with SQL Table read only in Access « MsSQL Server « IT news, forums, messages
Re: Strange issue with SQL Table read only in Access

Posted by Erland Sommarskog on 04/22/06 21:23

Rico (me@you.com) writes:
> Yea, I know what you're saying (and that should have been UPDATE HOUSE).
> My comment wasn't on the practicality of identifying records, but on
> the updatability of the table (since the table is not updatable with no
> ID). In a perfect world, there would be no bad design, but I have the
> uneviable task of converting a poorly designed Access FE to use an SQL
> Server back end. The table in question has a single record in it, and
> was never intended to have anything more than a single record in it.
> There is no ID field, just a field that is updated to either 'Yes' or
> 'No'. If I had the budget I would rewrite the whole program, which is
> very intensly complicated in terms of the information, calculations etc
> (it's forestry related), so it would be a greater task to take this
> crappy design and rebuild it properly. FWIW I always use an ID field,
> that's how I was taught. I would just like to know if there is
> reasoning that the table is not updatable without an ID field.

An ID field is not required. What is required is a primary key. And
that's a fine difference there. A primary key does not have to be an
ID, it could be license-plate numbers to take one (dubious) example.
Most of all, it could be a composite key. For instance in an OrderDetails
table the key would be (OrderID, RowNo) or (OrderID, ProductID), but
not (OrderDetailID).

Without a key, it's not possible to determine which row that is to be
updated.

Yes, in a one-row table it is possible, but apparently no one thought
special case be worth covering. Particularly since most tables start out
empty, and then pass through a phase as one-row tables. Would be
confusing if the table got read-only because you added a second row.

Easiest is to add a primary-key to the one row table.

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация