You have to think of all the possibilities.  What if two users create a blog
entry at the same time?  The time stamp would NOT be unique.

You need to look at WHY you need a primary key.  If the purpose is to be
able to access a unique blog entry, then look at what information you would
need to get that.  A simpler approach would be to use an entry ID as Joe
stated, but without the user ID as part of it.  You can store the next value
in your "parameters" table and retrieve/increment it when a new entry is
added.

...Glenn

On Tue, Nov 18, 2008 at 11: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.
>>
>

Reply via email to