Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
it works when i run your script but when i do it in my query i get returned 5/9/2010 8my query is select a.id,CONVERT(varchar(10),a.datetime,112),a.datetime from may a
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts
Posted - 2010-07-01 : 15:16:38
What datatype is the filed "a.datetime"...Doesn't appear to be datetime. If its varchar, I guess you should be doing string formatting to get your desired output.Or..try this
select a.id,CONVERT(varchar(10),convert(datetime,a.datetime),112),a.datetime from may a
X002548
Not Just a Number
15586 Posts
Posted - 2010-07-01 : 17:43:22
quote:Originally posted by esthera how can i convert a date
Yes, it's probably defined as varchar...while doing what vijay said, should work (I didn't test it), you really should consider changing the datatype of your column...unless of course you'll blow up a lot of programs, in which case I would say don't do anythingBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam