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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:16:04+00:00 2026-06-12T23:16:04+00:00

I need to retrieve data by selected dates. There is one major detail: user

  • 0

I need to retrieve data by selected dates. There is one major detail: user can select two days one after another, and then it can skip some days, and then select another ones.

What is the best way to pass selected dates into a stored procedure and organize filter by such date ranges?

For example, I have the table with the following structure:

CREATE TABLE [dbo].[Events](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [EventDate] [datetime] NOT NULL,
    [Amount] [float] NOT NULL,
 CONSTRAINT [PK_Events] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

With the following data:

INSERT [dbo].[Events] ([EventDate], [Amount]) VALUES ('2012-01-01 10:00', 12)
INSERT [dbo].[Events] ([EventDate], [Amount]) VALUES ('2012-01-01 11:00', 154)
INSERT [dbo].[Events] ([EventDate], [Amount]) VALUES ('2012-01-01 12:00', 4)
INSERT [dbo].[Events] ([EventDate], [Amount]) VALUES ('2012-02-01 10:00', 132)
INSERT [dbo].[Events] ([EventDate], [Amount]) VALUES ('2012-02-01 11:00', 212)
INSERT [dbo].[Events] ([EventDate], [Amount]) VALUES ('2012-03-01 10:00', 712)
INSERT [dbo].[Events] ([EventDate], [Amount]) VALUES ('2012-03-01 20:00', 892)

User wants to retrieve data with Event Date from 2012-01-01 10:00 and 2012-01-01 11:00,
from 2012-03-01 09:00 to 2012-03-01 19:00, etc.

User can select different count of intervals.

  • 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-12T23:16:05+00:00Added an answer on June 12, 2026 at 11:16 pm

    If you want to send multiple “identical” parameters to a stored procedure, that would usually indicate that you should use Table Valued Parameters (TVPs).

    Within the stored procedure, you can treat the TVP as a table variable, so your query would look like:

    SELECT
        *
    FROM
        Events e
            inner join
        @MyTVP t
            on
                e.EventDate between t.FromDate and t.ToDate
    

    Assuming your TVP has two columns, FromDate and ToDate with obvious definitions.

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

Sidebar

Related Questions

I need to retrieve data from two tables. the first is a list of
I need to retrieve data from one table and use it to retrieve data
I need to retrieve data (usernames and email addresses) from two separate databases on
i'm doing a project where i need to retrieve data from one field of
I need to retrieve data from MsAccess/SQL Server (two separate projects in which I
this is my code where i need to retrieve data sent in POST: @play.db.jpa.Transactional
I have a situation where I need to retrieve data from a query which
Im stumbling upon a problem where i need to retrieve data from the following
I need to retrieve a simple page and use the data that it returns.
using jquery I need to retrieve an array from table cells, format the data

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.