Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Address track null value???

Author  Topic 

Lincolnburrows
Yak Posting Veteran

52 Posts

Posted - 2014-09-02 : 05:12:14
In my Sql Server 2012 I have the following table in a database
CREATE TABLE [dbo].[HumanResource](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[IsHired] [bit] NULL,
[Address] [nvarchar](max) NULL,
[Score] [bigint] NULL,
[LastUpdate] [datetime] NULL,
CONSTRAINT [PK_HumanResource] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
when I update the Address field (nvarchar, not null), it is captured as below
NULL 3 2 mahmood True here 111 2014-09-01 14:42:28.913
NULL 4 2 mahmood True there 111 2014-09-01 14:42:28.913
but when I update the Score field (nvarchar, null), this is captured
NULL 3 2 mahmood True NULL 111 2014-09-01 14:42:28.913
NULL 4 2 Mahmood True there 111 2014-09-01 14:42:28.913
Considering that sql server Update is a chained Delete and Insert, the first row is the delete row capture and the second one is the insert row capture.
But I don't understand why the address is tracked as NULL when I update other fields, I would appreciate any information on this issue.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-09-02 : 06:32:22
you have a insert / update trigger is it ?

please post your trigger here


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -