|  | Posted by imani_technology_spam@yahoo.com on 09/18/06 22:28 
I'm using SQL Server 2005.  By the way, the front-end app is an AccessData Project.
 
 Erland Sommarskog wrote:
 > imani_technology_spam@yahoo.com (imani_technology_spam@yahoo.com) writes:
 > > Thank you for the response.  Please bear in mind that the LabID is the
 > > identifiable key; it is the PK for the table.
 >
 > In such case you cannot use an AFTER trigger. A primary key cannot be NULL,
 > so it must have a value when you insert the data. Furthermore, if there is
 > no other data to correlate, it's impossible to handle multi-row inserts.
 > And a trigger that would reqiure rows to be inserted one at a time, is
 > completely indefensible. This could have serious impact the day you
 > need to insert many rows.
 >
 > > Also, I don't understand why LabID = @curyear + @curmax + i.newlabid
 > > instead of @curyear + (@curmax + 1).
 >
 > If you insert 10 rows at the time, you cannot give them all the same
 > ID, can you?
 >
 > > Finally, could you please explain to me why the UNION statements are
 > > necessary?
 >
 > I wanted to test that the trigger actually works with multi-row inserts.
 > SELECT UNION is a way to achieve that without using a table to select
 > from.
 >
 > I think it's possible to do this with INSTEAD OF trigger, but then I
 > need to know which version of SQL Server you are using.
 >
 >
 > --
 > 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] |