Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAX isn't?
Message
From
18/09/2015 10:27:09
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Environment versions
SQL Server:
SQL Server 2008 R2
Application:
Web
Miscellaneous
Thread ID:
01624759
Message ID:
01624778
Views:
64
>>I have a temp table that for a particular UserID has CompletionDates of 10/24/2014, 08/02/2015, and 09/14/2015
>>
>>My command is
>>
>>Select Max(completionDate) from #TempTable where UserID = 9999999
>>
>>it returns the 2014 date, which makes my brain go 'bwuh?'
>>
>>What's going on here?
>
>Two things....can you confirm the data type for the CompletionDate column? Just wondering if it's a character column instead of a date/datetime column.
>
>If it's a character column, that's your problem.
>
>If it's a date/tdatetime. are you absolutely certain that the values for 2014 are associated with the row where UserID is the 9999999?

Yep, that's what's happening. It's getting converted to a varchar(10) before I grab the MaxDate

Thanks Kevin
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform