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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:34:11+00:00 2026-06-13T09:34:11+00:00

I have inherited a large SQL Server database that has a certain table that

  • 0

I have inherited a large SQL Server database that has a certain table that has a certain date column that is a varchar(8) datatype in the yyyyMMdd date string format. Why it isn’t a datetime datatype or something similar is beyond me. (maybe to save space? Legacy db ported to SQL Server long ago?)

Withouting getting too flustered over the date wanna-be field, grabbing rows using a single date from this column is pretty straight forward using the Entity Framework (DBContext w/LINQ) as shown below:

var rows = cxt.TableOfRandomDateColumn.Where(x => x.Date == myDateStr).ToList();

That’s about as easy as it gets. However, what if I wanted to grab a range of dates from this column? What would be the best way to go about doing something like that?

  • 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-13T09:34:12+00:00Added an answer on June 13, 2026 at 9:34 am

    Dates in the yyyyMMdd format are alphabetically as well as numerically ordered correctly, so you can just use a range selector as you would for any other string column.

    Try this:

    var rows = cxt.TableOfRandomDateColumn.Where(x => x.Date >= myStrDateStr && x.Date <= myStpDateStr).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited a fairly large SQL Server database. It seems to take up
We are using SQL Server 2008 Enterprise version. We have a large table FooTable
I have recently inherited a large Java Application that has almost no Thread safety
I have inherited a project that has a large number of source files. I
I have inherited an application that logs the results of certain daily commands that
I have a SQL Server 2005 database with several tables. One of the tables
I need to transfer a large number of rows from a SQL Server database
I have inherited a large admin winforms application that shares a 'Common' library of
I have inherited this sed script snippet that attempts to remove certain empty spaces:
I am am trying to construct a database in SQL Server 2008 R2 that

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.