By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,377 Members | 1,330 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,377 IT Pros & Developers. It's quick & easy.

Trigger problem

P: 3
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 [NewCustomerToLMS] 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(name1,name2)values(@UserID,@Email)
end
go
Apr 22 '08 #1
Share this Question
Share on Google+
2 Replies


ck9663
Expert 2.5K+
P: 2,878
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 [NewCustomerToLMS] 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(name1,name2)values(@UserID,@Email)
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
Apr 22 '08 #2

P: 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
Apr 22 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.