Link to home
Start Free TrialLog in
Avatar of zimmer9
zimmer9Flag for United States of America

asked on

How to store a date field in format mm/dd/yyyy into a SQL Server 2008 table?

I am using SQL Server 2008.

If I pass a date value in format "mm/dd/yyyy" as a parameter into a date field titled DateInput within a table named tblDate, is there a way to store this value in this format into this SQL Server table?
Avatar of Russ Suter
Russ Suter

If you store the value in a column of data type string then yes. If you store it as a Date, DateTime, or DateTime2 data type then no. However you can format the data on the way out. Your SELECT query would look something like this:
SELECT
  CONVERT(VARCHAR, DateInput, 103) as [DateInput]
FROM
  tblDate

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
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
SOLUTION
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
Avatar of zimmer9

ASKER

I think you meant 101 but I understand. Thanks.  :)