Re: getting values from inserted table

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Brian Henry (brianiup[nospam)
Date: 03/12/04


Date: Fri, 12 Mar 2004 10:13:23 -0500

well im baseing it on a row count and processing the rows one by one, that
was just a quick example :)

"Craig Yellick (Alto)" <CraigGoogle@Yahoo.com> wrote in message
news:Oaom%23uDCEHA.1588@tk2msftngp13.phx.gbl...
> You can bind muliple columns to variables using the following SELECT
> syntax:
>
> declare @Var1 int
> declare @Var2 int
> declare @Var3 int
>
> select @Var1=Col1, @Var2=Col2, @Var3=Col3
> from inserted
>
> Also, watch out: the inserted virtual table can have multiple rows. The
> vast majority of time when you're testing your trigger you'll be
> inserting a single row at a time, but that does not mean that a
> multi-row insert will never happen. If you test the record count when
> the trigger starts you can raise an error that lets the caller know that
> inserts must be serialized due to the way your code works. This will be
> a lot less mysterious a year from now when everyone has forgot all about
> the trigger.
>
> -- Craig Yellick, Alto
> http://altoConsulting.com
> http://altoTraining.com
> http://altoCRM.com
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: Why data could not be committed into table?
    ... int default 0, ... CREATE TRIGGER Feeds_update_trg ... DECLARE @PrevClose decimal ... > production system, execute it through QA against that same production ...
    (microsoft.public.sqlserver.programming)
  • Re: getting values from inserted table
    ... declare @Var1 int ... vast majority of time when you're testing your trigger you'll be ... inserting a single row at a time, but that does not mean that a ...
    (microsoft.public.sqlserver.programming)
  • Re: Update Inserted Record
    ... > sequence key in the Parent View called V_InvItems - I need the view as ... > CREATE trigger update_ServiceHistory ... > Declare @Action INT ...
    (microsoft.public.sqlserver.programming)
  • Help with a list variable
    ... then looping through the list and inserting the values into ... the temp table, then selecting all the records from teh temp table. ... DECLARE @startingPosition int ...
    (comp.databases.ms-sqlserver)
  • Trigger
    ... I 'm new to Triggers, and I like to ask what is the problem with my trigger ... The USER table containts 'WC_USER_ID','WC_USERNAME'(name ... DECLARE @PRODUCTID int ...
    (microsoft.public.sqlserver.server)