Link to home
Start Free TrialLog in
Avatar of Member_2_6478753
Member_2_6478753Flag for United States of America

asked on

MS SQL

sql DATETIME DEFAULT  getdate(), 'yyyy/MM/dd hh:mm:ss tt', 'en-US' ); ();



i want to make a default date when i insert new record in database
only i need to insert required field like username and password and automatically the datetime will be insert as default in each insertion  

how i can do it ? in sql
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

If you want the value inserted automatically when adding a record to the table then you need to set the default property:

ALTER TABLE myTable ADD  DEFAULT (getdate()) FOR myColumn
Avatar of Member_2_6478753

ASKER

i know this .. i want specific format in default datetime   like this ..  DEFAULT  getdate(), 'yyyy/MM/dd hh:mm:ss tt', 'en-US' ); ()
I've requested that this question be deleted for the following reason:

i have found the solution from sql server ebook
What is tt?
If you have found a solution, post it so others can benefit and then accept your own answer. Don't delete the question.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_6478753
Member_2_6478753
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The date on sql server will be stored as Data type : datetime
than if you want to convert it to another format you should choose a function to convert to your format and the link below http://www.sql-server-helper.com/tips/date-formats.aspx
help you in choosing format type.