Home
How It Works
Daily Challenge
Contact

Companies
Register
Login
Recruiter Tools
Post SqlAds
Resume Razor
Candidates
Register
Login
My Info
Employment
Submit Question
Training
Intro to
Informatica
Ask Mark
Recent Topics
Resume Courier
Top 10
grabowski
vlg
anjugarg
billw
jjahns
drj
nisha
nishardhini
grifman
kalaabhyas
 

Pete Russitano Design >


Yesterdays Results
86% Correct
14% Incorrect
Sponsored Jobs
Business Analyst
Windsor, CT
Insurance B/A   more...
Contact Us
Project Manager (Multiple)
Windsor, CT
Junior to Senior Level Project Managers with Insurance Background   more...
Contact Us
DataStage Developer
Iowa, IA
DataStage, Informatica, Oracle, Team Leader   more...
Contact Us
Production Support Analyst - Unix, FTP
Bristol, CT
Momentum, Odin, ConnectDirect, Tidal, BARR, and Tandem application and O/S software   more...
Contact Us
Data Analyst
Shelton, CT
MSAccess, SQL Sever, SQL, DBase, Clipper, Foxpro   more...
Contact Us
Database Programming Specialist
Atlanta, GA
Advanced SQL query experience; - Five years of experience in software development; - Experience in building web-based programming applications with relational databases in a multi-tier environment   more...
Contact Us
IT Analyst (business analyst)
Bristol, CT
documentation, user interaction re: full sdlc responsibility. Security access, full sdlc, post-requirement.   more...
Contact Us
Saiko Consulting's SqlChallenge
Saiko Consulting's SqlChallenge
CareerFactor
Saiko Consulting

Read A Topic

Return To Topics Originally Posted:  6/6/2006 6:24:45 PM
  Last Updated:  6/6/2006 6:24:45 PM

Subject:
Date Parsing using Transact SQL

You Asked....
How do I covert a date in the string format 19960303 to a date?

and we responded....
I went around and around with this one when I first started programming T-SQL.

Try this it should work.

SELECT CONVERT(smalldatetime,'19960303',112)


others said.... Post Your Own Review

Review By:  naka55

The style parmater on the CONVERT is not necessary. It's only needed when you want to convert to a specific format

>>>>>Begin Original Message<<<<<

How do I covert a date in the string format 19960303 to a date?

>>>>>End Original Message<<<<<

Review On:  6/6/2006 6:51:39 PM


Review By:  Gary

>>>>>Begin Original Message<<<<<

How do I covert a date in the string format 19960303 to a date?

>>>>>End Original Message<<<<<

You can also use CAST such as:

CAST('1996030' AS smalldatetime)
or
CAST('19960303' AS datetime)

Review On:  6/9/2006 3:07:32 AM


Review By:  Tina Bhate

>>>>>Begin Original Message<<<<<

How do I covert a date in the string format 19960303 to a date?

>>>>>End Original Message<<<<<

Hello Friends,

Yes, by using CAST function you can get the output.
BUT if we you CONVERT then we can specify the format means 112 is a particular format for data type...so is 106.
CONVERT is most recommended and oftenly used in case of DATE.

Review On:  6/13/2006 4:25:00 PM