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 |
mike13
Posting Yak Master
219 Posts |
Posted - 2007-04-11 : 18:23:47
|
hi alli got an order by date(datetime collum) but it messes up the years! any idea?tnx,mike |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-04-11 : 18:31:19
|
You haven't provided enough information for us to help you. Please post a data example of what the problem is.Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-11 : 19:06:30
|
quote: Originally posted by mike13 hi alli got an order by date(datetime collum) but it messes up the years! any idea?tnx,mike
Are you using varchar to store date ? KH |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-12 : 01:31:22
|
quote: Originally posted by mike13 i got an order by date(datetime collum) but it messes up the years! any idea?
Show us the query.Peter LarssonHelsingborg, Sweden |
 |
|
mike13
Posting Yak Master
219 Posts |
Posted - 2007-04-12 : 03:03:40
|
hii see where i got my problemSELECT TOP (100) PERCENT COUNT(*) AS COUNT, dateFROM (SELECT CONVERT(CHAR(8), date, 10) AS date FROM dbo.T_Static_page) AS TSPGROUP BY dateORDER BY datethis gives this result1885 01-01-071831 01-02-073292 01-03-071607 01-04-07949 01-05-071880 01-06-071412 01-07-07if i do normal select, i get the time with it, which i dont want and prevents me to do the group by day.ex:SELECT TOP (100) PERCENT COUNT(*) AS COUNT, dateFROM (SELECT date FROM dbo.T_Static_page) AS TSPGROUP BY dateORDER BY date DESC1 12-4-2007 9:02:301 12-4-2007 9:02:201 12-4-2007 9:02:011 12-4-2007 9:01:531 12-4-2007 9:01:151 12-4-2007 9:00:591 12-4-2007 9:00:491 12-4-2007 8:59:35any suggestions?tnx a lot,mike |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-12 : 03:06:45
|
quote: CONVERT(CHAR(8), date, 10)
Why are you converting date to char ?the column date is of datetime data type ? KH |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-04-12 : 07:34:52
|
1 Do normal Select2 Format dates in front end(If you use it) MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|