[dba-SQLServer]opinions

Arthur Fuller artful at rogers.com
Sun Mar 16 12:13:32 CST 2003


I'm not sure why you would want to do this, Susan, but assuming that you
want to, a trigger would do it. Do something like this in your trigger
(caution: written in Outlook :-).

DECLARE @myGUID as GUID
SET @myGUID = NewID()
-- do something with the new GUID
...

Since you could export this logic to the db rather than contain it in the
FE, I'm not sure why you'd want to do it. This comes from a perspective
which says, "Anything MS will do for me free is code I don't have to write."
IOW I'd create a default value for the column (=NewID()) and be done with
it. The Front End would receive the new value just like an ANPK, so why
bother writing code to create it?

A.


-----Original Message-----
From: dba-sqlserver-admin at databaseadvisors.com
[mailto:dba-sqlserver-admin at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: March 16, 2003 12:37 PM
To: SQLList
Subject: [dba-SQLServer]opinions


I'd like some opinions on using an Insert Trigger to insert a GUID value to
a new record. Good idea or bad?

Susan H.


_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list