Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 DateTime Conversion
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

105 Posts

Posted - 11/13/2012 :  15:48:30  Show Profile  Reply with Quote
In my SELECT clause I have:


... and in my WHERE clause I have:

When executed, I get "Conversion failed when converting date and/or time from character string".

I looked at using CONVERT but can't seem to make it work. And, is it the 'MAXDATE' and 'MAXTIME' from the SELECT clause that needs conversion? Or is it something in the WHERE clause?

Almighty SQL Goddess

38200 Posts

Posted - 11/13/2012 :  15:50:51  Show Profile  Visit tkizer's Homepage  Reply with Quote
MAXDATE/MAXTIME in your SELECT are just aliases. The WHERE clause is why you are getting that error. You can't specify the MAXDATE/MAXTIME aliases as that's where data goes. If you want it equal to MAXDATE/MAXTIME, you'll need a subquery.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server

Subscribe to my blog
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000