pf » Dear SQL Server Enterprise Manager Developer
Dear SQL Server Enterprise Manager Developer
Please add a button to make a column an identity.
You have a button to set as primary key, why do we have to scroll down through 3/4 of the properties, click the plus under "Identity", and then choose "Yes" for such a common operation?
Thank You
Need Help With SQL?
Related Entries
- Cheat Sheet for SQL Server - April 20, 2009
- DateFormat for SQL Server - December 5, 2008
- Try Catch for SQLServer T-SQL - April 7, 2008
create table myTable ( myId int not null IDENTITY(1,1) PRIMARY KEY)
The big problem with them is that they often allow for the entry of duplicate data that differs only by the id value. Things seem to work out much better if you can find a better candidate key in your data, even if it's a complex key.
I think the use of the primary key can be completely separate from other constraints you may need on a table. As Pete points out, you can still set a unique constraint on a set of columns without making that complex key into the primary key.
I often do that, especially in child tables. Example: a folder table and a file table, where the file name has to be unique per folder, but not across folders, so maybe like this:
PK: fileID FK: folderID unique constraint: folderID, fileName
At that point, whether my keys are integer or UID or whatever, they're independent of the uniqueness. I think that the cross-table lookups are faster when the RDBMS doesn't have to compare complex keys.
It is a design decision, and with all design decisions there are trade offs.
Something similar happens with deletes -- the best solution is to allow users to undo deletes so they can correct their own mistakes, but the best solution is rarely implemented because it involves more work than the lame alert box the users actually get.
I will say that SQL identity columns have caused major headaches at every company I've worked for, not because of duplicate data, but because they've always resulted in the data migration migraine... okay, let's move the data from... wait... can't do that, okay, then we'll copy the data to... nope, can't do that either... okay, then we'll drop and recreate and ... AAARGH! And for the record, no, enabling identity insert didn't resolve any of those problems for us.
But yeah, if it's a recommended solution, it should be easier to set in their admin tool.
- ColdFusion 8 FCKeditor Vulnerability
- Ajax Same Origin Policy No More with Firefox 3.5
- Firefox 3.5 Introduces Origin Header, Security Features
- Tips for Secure File Uploads with ColdFusion
- 7 Years And Blog Entry Number 700
- CFCatch Java Exceptions
- Cheat Sheet for SQL Server
- CFML on Google App Engine for Java
RSS
add to del.icio.us
Pete Freitag is a software engineer, and web developer located in











