NameSilo

[Resolved] MSSQL Sorting Woes

Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
SpaceshipSpaceship
Watch

Unknown

Established Member
Impact
3
MSSQL Sorting Woes

I'm trying to retrive the top 5 rows of a table based on the column "DateAdded" whose value is supplied via an ASP.NET script when a new row is inserted into the table. Currently when I run the SQL statment all works well except for the fact that it assumes that one digit days are newer than 2 digit days, so:

It will show 11/5/2008 before it shows 11/12/2008
11/1/2008 11/20/2008

here is my current statment:
Code:
SELECT     TOP (5) PlaceId, UserId, PlaceName, PlaceLocation, PlacedDateAdded
FROM         places_table
ORDER BY PlacedDateAddedDESC
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
this may not be it but in the statement you have:-

PlacedDateAddedDESC

try putting a space before DESC

Also are you receiving any error messages?
 
1
•••
Figured it out. I guess I never set the column type as SmallDateTime, instead it was NVarChar :P thanks
 
0
•••
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

Parking: find your domains by pasting a list
You can now paste a list of domain names into the search box at the top of the Parking menu. Put one name on each line. Your domain list...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back