Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3987966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:11:47+00:00 2026-05-20T06:11:47+00:00

This is part of a big query. What I’m trying to do is, if

  • 0

This is part of a big query.

What I’m trying to do is, if the variable @exemptionStartDate = '1900-01-01', then just select everything,

ie. ce.ExemptionStartDate = ce.ExemptionStartDate.

Otherwise, I only want rows where ce.ExemptionStartDate > @exemptionStartDate

ce.ExemptionStartDate is of DateTime value

SELECT foobar 
WHERE foo = bar
AND ce.ExemptionStartDate = CASE WHEN @exemptionStartDate = '1900-01-01' THEN ce.ExemptionStartDate ELSE (> @exemptionStartDate) END

is it possible? Or will I have to do the hacky thing of making everything a long string, and just adding onto it as necessary?

I’m getting a syntax error, and don’t know how to form such a thing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:11:48+00:00Added an answer on May 20, 2026 at 6:11 am

    not need to complicate matters

    if @exemptionStartDate = '1900-01-01'
    set @exemptionStartDate = '1753-01-01' --lowest date for datetime
    

    and then it is just

    where ce.ExemptionStartDate > @exemptionStartDate
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying this as part of a big query: (CONVERT(varchar(20), AZ_DTA_APP_AGE, 103) + '
I got this error when I'm trying a script. mySQL query error: SELECT *
I'm developing a game, a big part of this game, is about scrolling a
Hi I am just starting to learn C++. I bought this big C++ for
There is this stored procedure that builds a dynamic query string and then execute
(As the 'homework' tag indicates, this is part of a big project in Computer
this is somewhat related to my earlier query.. Reading A Big File With Python
I have this query: SELECT `country` FROM `geoip_base` WHERE 1840344811 BETWEEN `start` AND `stop`
So, I have this query: SELECT count(*) AS count FROM table1 INNER JOIN some
This part of my code works fine: #include <stdio.h> int main(){ //char somestring[3] =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.