Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 convert varchar to date

Author  Topic 

anaji
Starting Member

15 Posts

Posted - 2012-06-10 : 07:53:38
Gurus,

i have this query

anaji
Starting Member

15 Posts

Posted - 2012-06-10 : 07:54:59
sorry here is what i mean

CONVERT(varchar(20),[START_DATETIME],101) AS DATE_TIME

this converts to varchar , i want to convert it again to date afterit converts to varchar how can i do that?


thanks,
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-10 : 15:24:54
why do you need to do it in sqkl? if its for a presentation why not do this at front end using formatting functions?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

anaji
Starting Member

15 Posts

Posted - 2012-06-11 : 01:26:38
well after i query the values are passed to another DB that uses another application that we have, so it is set as date in the other DB, and if i try to change it over there it tells me you can't change the format you have to do it in the source data, that''s why i want to change it as date and then pass it to the other DB
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2012-06-11 : 03:18:01
It seems to me you want to trim the time part.

SELECT CAST(START_DATETIME AS DATE)

will do.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -