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 8766371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:32:10+00:00 2026-06-13T16:32:10+00:00

I have a huge database in ms sql. I have a date stored into

  • 0

I have a huge database in ms sql. I have a date stored into a field of type: VARCHAR2
I have the code, but it can’t compare dates. What I mean? There is an input with a launch date. What I need is to get the launchdate inputs where the launchdate is bigger than a date and smaller than another. The problem is that when I change the year from 2012 to 2013 there are no results. Also when I have dates with 0 (like 01.01.2012) it can’t compire them.

What I have so far is:

edited

Can someone help me to get the correct results?

EDIT1

The date is stored as string in this format: yyyy-mm-dd

  • 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-06-13T16:32:11+00:00Added an answer on June 13, 2026 at 4:32 pm

    In your WHERE clause you are doing a double conversion unnecessarily and actually comparing VARCHAR not DATETIME

    To compare DATETIME following is enough.

    CONVERT(DATETIME, p11.pa_value,104) >= CONVERT(DATETIME, '01.01.2012',104)
    

    Or you can CAST

    CAST(p11.pa_value AS DATETIME) >= CAST('01.01.2012' AS DATETIME)
    

    EDIT: I think you need to check for NULL values of [t].PA_NAME as well

    ISNULL([t].PA_NAME,'') = 'yourString'  --if you need filter null PA_NAME
    ISNULL([t].PA_NAME,'yourString') = 'yourString' --if you need to bring null PA_NAME
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge database (800MB) which consists of a field called 'Date Last
I have a huge database with 100's of tables and stored procedures. Using SQL
I have a huge database with rows structured by the fields date, ad, site,
I know implementing database is a huge topic, but I want to have a
I have a huge database with some 100 tables and some 250 stored procedures.
We have a huge Oracle database and I frequently fetch data using SQL Navigator
Is there any way I can Import a huge database into my local server.
I have a huge database which holds pairs of numbers (A,B), each ranging from
I was recently pondering the following scenario: suppose you have a huge database and
I have huge amount of data from database, i need to get or store

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.