Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

problem with default constraint Expand / Collapse
Posted Tuesday, January 21, 2014 2:30 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, April 12, 2015 10:56 PM
Points: 5, Visits: 11
hi everyone here my problem is that if we have used default constraint with table so it not working so plz tell me any exaple of default constraint
thank you......
Post #1532917
Posted Tuesday, January 21, 2014 2:40 AM



Group: General Forum Members
Last Login: Saturday, December 3, 2016 5:18 AM
Points: 45,619, Visits: 44,147
Define 'not working'?

What exactly did you do? What behaviour are you expecting? what are you seeing?

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1532920
Posted Tuesday, January 21, 2014 3:39 AM



Group: General Forum Members
Last Login: Yesterday @ 12:29 PM
Points: 17,173, Visits: 32,140
Please supply a bunch more detail, especially the code you wrote and what you expected it to do for you.

"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server Query Performance Tuning
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1532939
Posted Tuesday, January 21, 2014 5:40 AM



Group: General Forum Members
Last Login: Today @ 1:44 PM
Points: 14,557, Visits: 38,445
even if you have a default constraint in place, if you have a data access layer that explicitly sends NULL to be the column value, then NULL it shall be.
defaults are only used when a value is not provided.

As others have mentioned, more details will get you some better answers, but that was the first thing i thought of when i read "default not working"


help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #1532988
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse