Convert nvarchar to date

Hello All,

I am trying to find conversion function particular to our data in MS SQL server. I have experience working with Oracle but I am struggling to find the equivalent function in MSSQL. Hope someone can help me out here.

Following columns:


	[need_by_date] [nvarchar] (150)
	[date_requested] [nvarchar] (100) 

and column values:


	Dec  2 2003  1:54PM
	11/14/2003 

I tried using the convert(datetime,column_name) but the first column gives me an error, second one is fine.

Any input is appreciated.

Thanks, Mani


nnemani :canada: (BOB member since 2004-09-28)

oops an error. The column values are reversed.


nnemani :canada: (BOB member since 2004-09-28)

Hi Mani,

The convert function should work.

I have tried

select convert(datetime,'11/14/2003 ') and select convert(datetime,'Dec 2 2003 1:54PM ').

Both worked perfectly.

Regards,

Mo


Mannou :tunisia: (BOB member since 2006-05-07)

Hi Mo,

Yes it works like that in select statement but when i replace it with database column name then i am getting conversion error for the first column. The second column conversion works fine. And I cannot figure out what is the problem. Is it the data causing this? Or the column setup?

Thanks, Mani


nnemani :canada: (BOB member since 2004-09-28)