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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:46:08+00:00 2026-06-07T06:46:08+00:00

Our chief database programmer is out this week on vacation and I’m stuck. I

  • 0

Our chief database programmer is out this week on vacation and I’m stuck.

I have a view that’s getting created that includes the following sub-query:

select cast(cast(getdate() + i as date) as datetime) DATEVALUE 
from NumbersTable(1,100,1)

I have no idea what this does, and when I try to run it inside of Squirrel, I get:

Error: Procedure or function NumbersTable has too many arguments specified.
SQLState:  37000
ErrorCode: 8144

Here are the function creates for NumbersTable:

    CREATE FUNCTION NumbersTable (
  @fromNumber int,
  @toNumber int,
  @byStep int
) RETURNS TABLE
RETURN (

WITH CTE_NumbersTable AS (
  SELECT @fromNumber AS i
  UNION ALL
  SELECT i + @byStep
  FROM CTE_NumbersTable
  WHERE
  (i + @byStep) <= @toNumber
)
SELECT * 
FROM CTE_NumbersTable
)
;

and

CREATE FUNCTION NumbersTable (
  @fromNumber int,
  @toNumber int
) RETURNS TABLE
RETURN (
WITH T_0_THRU_15 AS (
SELECT 0 j UNION ALL
SELECT 1 UNION ALL
SELECT 2 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 5 UNION ALL
SELECT 6 UNION ALL
SELECT 7 UNION ALL
SELECT 8 UNION ALL
SELECT 9 UNION ALL
SELECT 10 UNION ALL
SELECT 11 UNION ALL
SELECT 12 UNION ALL
SELECT 13 UNION ALL
SELECT 14 UNION ALL
SELECT 15 
)
SELECT T1.j + (T2.j*16) + (T3.j*256) + @fromNumber i
FROM   T_0_THRU_15 T1, T_0_THRU_15 T2, T_0_THRU_15 T3
WHERE T1.j + (T2.j*16) + (T3.j*256) + @fromNumber <= @toNumber
)
;

I am running this against Microsoft SQL Server 2008 R2. The strange thing is that I believe I have run this code against this database before and it worked and I simply don’t know what to do now.

  • 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-07T06:46:12+00:00Added an answer on June 7, 2026 at 6:46 am

    NumbersTable is probably a table valued function.

    Try this:

    select cast(cast(getdate() + i as date) as datetime) DATEVALUE  
    from dbo.NumbersTable(1,100,1) 
    

    It probably means “return the values from 1 to 100 in increments of 1”.

    SQL Fiddle Example

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

Sidebar

Related Questions

Our team (QA) is facing the following problem: We have a database that is
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
Our Django project is getting huge. We have hundreds of apps and use a
I have been using Chef to manage our servers. My roles/app.rb looks like this:
Our company have a need to set up some solution, that would allow us
Our company produces cross-platform software and we have Bamboo instance which is building projects
We have a mid-size SQL Server based application that has no indexes defined. Not
Example: I have two tables in my database called classA and classB , and
I'm aware that similar questions on SO are numerous, but I have a caveat.
Our application uses an animation to fade out a message window when it's closed.

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.