Not me...I would absolutely recommend against a timestamp as a primary key - primary keys should be easily referenced by other tables. For example, if this is your blog entry table, you may want a blog comment table that has a foreign key to your entry table. I wouldn't want that foreign key to include a timestamp. I would either use a regular Identity column (meaning you wouldn't have the natural order by user), or the dual-column key of userid and entryid that allows all users to have a natural order on their entries.
If it was me, I'd have a simple identity primary key, as Glenn suggests. If your users really want to see their natural order (everybody gets a 1-2-3-4), then you can add that as an additional column that's for reference only, and not the primary key. On Nov 18, 9:03 am, "Jon Liu" <[EMAIL PROTECTED]> wrote: > ok...so you're saying it would be better just to use the unique timestamp as > my unique identifier? > > On Tue, Nov 18, 2008 at 8:00 AM, Joe Enos <[EMAIL PROTECTED]> wrote: > > > If after all of this you still want to proceed, I'd suggest a two- > > column primary key, with the userid being the first part, and a new > > regular integer being the second part. You can store "lastentryid" or > > "nextentryid" in an int column on the user table, then reference it > > whenever you need to insert a record. > > > I don't think you can both access and increment this column from > > inside a function, so I think you'd either need to have your entire > > statement inside of a stored proc, or use two separate commands. > > > On Nov 17, 9:50 pm, BigJ <[EMAIL PROTECTED]> wrote: > > > I see a formula section, but not sure how to go about it. I basically > > > have an primary key called "EntryId" and I want to consist of UserId > > > +unique counter, so if UserId="BigJ", and it's my first entry, then > > > EntryId="BigJ1" and the next entry would be BigJ2 etc....any insight > > > as to how to accomplish this? I know there is a formula field and I am > > > looking into it, but any insight or simple examples are apreciated, as > > > I left my SQL book at home lol...Thanks... > >
