Trigger problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ccopinc
    New Member
    • Sep 2007
    • 3

    Trigger problem

    I am having a problem with the trigger listed below. The userID is retrieved ok from the inserted, but the email comes in as NULL every time to table dbo.test. But when I look at the record that was inserted into address the email is inserted.

    Please help I am so frustrated.

    alter Trigger [NewCustomerToLM S] on [dbo].[Address] after insert
    As
    begin
    set nocount on
    Declare @UserID int
    Declare @Email varchar (100)

    select @UserID = CustomerID, @Email =Email from inserted
    insert test.dbo.test(n ame1,name2)valu es(@UserID,@Ema il)
    end
    go
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by ccopinc
    I am having a problem with the trigger listed below. The userID is retrieved ok from the inserted, but the email comes in as NULL every time to table dbo.test. But when I look at the record that was inserted into address the email is inserted.

    Please help I am so frustrated.

    alter Trigger [NewCustomerToLM S] on [dbo].[Address] after insert
    As
    begin
    set nocount on
    Declare @UserID int
    Declare @Email varchar (100)

    select @UserID = CustomerID, @Email =Email from inserted
    insert test.dbo.test(n ame1,name2)valu es(@UserID,@Ema il)
    end
    go
    You're trigger was created on table Address. This table has columns CustomerId and Email. you're inserting the value of @Email to name2 on your test table. Is this the same column you're saying that's always empty? Or you have a separate column for email?

    -- CK

    Comment

    • ccopinc
      New Member
      • Sep 2007
      • 3

      #3
      yes same column... but I found the answer.. it wasnt in my trigger design but in the way the application saved data to the table. ty

      Comment

      Working...