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.
Author |
Topic |
partap26
Starting Member
27 Posts |
Posted - 2013-06-03 : 01:09:42
|
One table contains the date formats as dd-MMM-yyyy,MM-dd-yy etc. and other table contains the date as 2013-05-31, 2013-06-01 etci want to select one format from table say MM-dd-yy and fetch dates from the other table and want to apply the same format to the fetched dates. How to do thisss.... |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-03 : 02:32:00
|
You've to have consistent formats to avoid uncessary issues. And also try to use proper datatypes for your fields. The field has to be datetime or date if it stored date values.see reason herehttp://visakhm.blogspot.in/2011/12/why-iso-format-is-recommended-while.htmlwhat all different formats you've in column apart from dd-MMM-yyyy,MM-dd-yy ?they all have to be handled individually for ex dd-MMM-yyyy as CONVERT(datetime,REPLACE(yourdatecolumn,'-',' '),113)mm-dd-yy AS CONVERT(datetime,datecol,110) etc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|