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
 Other Forums
 MS Access
 convert or cast date to string

Author  Topic 

sqlnewbie82
Starting Member

11 Posts

Posted - 2007-10-22 : 09:28:33
hi i was wondering if it is possible to convert date/time field to string in sql

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-22 : 09:30:01
Yes.
Have a look at "CAST & CONVERT" in Books Online.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-22 : 09:31:37
Or see http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=80563



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-22 : 09:32:25
quote:
Originally posted by sqlnewbie82

hi i was wondering if it is possible to convert date/time field to string in sql


Yes but it depends on where you want to show/use formatted dates

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sqlnewbie82
Starting Member

11 Posts

Posted - 2007-10-22 : 10:59:48
i want to convert the date/time field to a string so that i can concatenate it with another string. if i concantentate it just like that, it will give me an error of type mismatch
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-22 : 11:09:19
The first two suggestions will give you the answer.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

sqlnewbie82
Starting Member

11 Posts

Posted - 2007-10-22 : 11:20:53
well i tried it, i am using microsoft access, so i dont think convert function is supported, coz i tried it and it said undefined function convert. so was wondering if there was another way

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-22 : 11:24:40
This is a MICROSOFT SQL SERVER forum.
Microsoft ACCESS questions is answered here http://www.sqlteam.com/forums/forum.asp?FORUM_ID=3

The Access equivalent is FORMAT. FORMAT(Col2, "yyyymmdd").



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-22 : 11:33:10
moved from new to sql server forum

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -