Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
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: Today @ 9:11 AM
Points: 43,450, Visits: 40,591
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
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: Today @ 8:28 AM
Points: 15,976, Visits: 30,341
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: Yesterday @ 12:38 PM
Points: 13,883, Visits: 35,808
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