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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update date feild switch format 1

Status
Not open for further replies.

alexanderthegreat

IS-IT--Management
Sep 9, 2005
70
0
0
US
how can I update my field licissuedate from date fields which look like this 20030520 to the short date format 05/20/2003? in my table garages
 
If your field is datetime or smalldatetime, SQL Server does NOT store dates and times in those fields as recognizable values. You can only set the format by 1) storing the date in a string format (VARCHAR/CHAR) or 2) by setting how it is to be displayed (using CONVERT). Refer to FAQ183-5834 for more information.

-SQLBill

Posting advice: FAQ481-4875
 
update garages
set licissuedate = convert(varchar,convert(datetime,licissuedate),101)

Server: Msg 241, Level 16, State 1, Line 1
Syntax error converting datetime from character string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top