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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:52:44+00:00 2026-05-20T00:52:44+00:00

Scenario is, database is in the maintenance phase. this database is not developed by

  • 0

Scenario is, database is in the maintenance phase. this database is not developed by ours developer. it is an existing database developed by the ‘xyz’ company in sql server 2000. This is real time database, where i am working now. I wanted to write the stored procedure which will retrieve me the records From date1 to date 2.so query is :

Select * from MyTableName
Where colDate>= '3-May-2010' and colDate<= '5-Oct-2010' and colName='xyzName'

whereas my understanding I must get data including upper bound date as well as lower bound date. but somehow I am getting records from ‘3-May-2010′ (which is fine but) to ’10-Oct-2010’

As i observe in table design , for ColDate, developer had used ‘varchar’ to store the date. i know this is wrong remedy by them. so in my stored procedure I have also used varchar parameters as @FromDate1 and @ToDate to get inputs for SP. this is giving me result which i have explained. i tried to take the parameter type as ‘Datetime’ but it is showing error while saving/altering the stored procedure that “@FromDate1 has invalid datatype”, same for “@ToDate”.

situation is that, I can not change the table design at all. what i have to do here ? i know we can use user defined table in sql server 2008 , but there is version sql server 2000. which does not support the same.
Please guide me for this scenario.

**Edited**

I am trying to write like this SP:

    CREATE PROCEDURE USP_Data  
    (@Location varchar(100),
    @FromDate  DATETIME,
    @ToDate DATETIME) AS

    SELECT     *
    FROM         dbo.TableName
    Where   CAST(Dt  AS DATETIME) >=@fromDate and  CAST(Dt  AS  DATETIME)<=@ToDate  and Location=@Location
    GO

but getting Error: Arithmetic overflow error converting expression to data type datetime. in sql server 2000
What should be that ? is i am wrong some where ? also

(202 row(s) affected) is changes every time in circular manner means first time sayin 
(122 row(s) affected)
run again saying 
(80 row(s) affected)
if again 
(202 row(s) affected)
if again 
(122 row(s) affected)

I can not understand what is going on ?

  • 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-20T00:52:45+00:00Added an answer on May 20, 2026 at 12:52 am

    Can you CAST() or put a view on this table and convert all the dates to DateTime values? I can’t remember if 2000 supported index views, but based on your varchar values (dd-mmm-yyyy), it’s going to be a nightmare to try and select date rages (possible, by parsing but a pain) with those values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.