conversion of string to date

Database

conversion of string to date

Hi,

Can someone help me in achieving the below format - converting from string to date..?

Existing data - AUGUST 2012 - Its a varchar

Desired data - 2012/07 - It should be date.

Thanks,

Chanukya.

Tags (1)
1 REPLY

Re: conversion of string to date

Try this -

SELECT CAST(CAST(CAST('AUGUST 2012' AS DATE FORMAT 'M4BY4') AS DATE FORMAT 'YYYY/MM') AS CHAR(7))

Thanks,

Shilpa