sql server - convert string format yyyy-mm-dd to dd/mm/yyyy -


ive got issue converting string field in ms sql table desired date format.

previously have used

convert(date,c.inp_date ,103) 

but gives me error

[err] 22007 - [sql server]conversion failed when converting date and/or time character string. 

two sample records have 2013-09-18 , 2013-09-18 17:17:32.0000000 receive import via mysql. need these converted dd/mm/yyyy time applicable.

any gurus out there appreciated :)

declare @a varchar(50) = '2013-09-18' , @b varchar(50) = '2013-09-18 17:17:32.0000000'  select convert(varchar(10),cast(@a date),103)  , convert(varchar(10),cast(@b date),103) 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -