Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting the dd/mm/yyyy constraint on a date field

Status
Not open for further replies.

daveonion

Programmer
Aug 21, 2002
359
GB
Hi
I am trying to put a constraint on a date field, so the only format entered will be dd/mm/yyyy, i am using the syntax

my_date = 'dd/mm/yyyy', but however it doesn't work, any ideas
by the way this is in the constraints part within the table diagrams

any help would be apreciated
 
A constraint applies to the data IN the database. DATETIME is not stored in the format you show or any other format. It's stored as eight bytes (four bytes are the number of days before or after the default and four bytes are the number of 'ticks' after midnight).

If you only want users to be able to input datetime in a specific way, use a trigger.

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top