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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 DEFAULT CONSTRAINT not working

Author  Topic 

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2013-02-22 : 20:41:25
Greetings

Ever come across this? I created a default constraint on ModifyDate and ModifyBy
When doing an update on a row the values of these column do not change. They are both nullable columns, it is something I have inherited and am unable to change the embedded oogly code on the site.

Not sure why the constraint are not doind what I was hoping to do when site calls UPDATE table set x = 0
Thanks

<><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-02-22 : 20:48:13
default constraint only take effect on INSERT statement. Not UPDATE


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

Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2013-02-22 : 20:51:17
are you serious!!!!!!?!? u learn something new all the time.

THanks Khtan!

<><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-02-22 : 21:02:05
http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx

if you want to handle the UPDATE, you need to use update trigger


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

Go to Top of Page
   

- Advertisement -