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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:21:08+00:00 2026-05-15T15:21:08+00:00

I have an input db2 table with two elements: loan_number, debt_to_income; this table’s name

  • 0

I have an input db2 table with two elements: loan_number, debt_to_income; this table’s name is #Input_Table. I am trying to run a test the function by running a SQL program against this table. The problem is that the function’s element is not being recognized in the SQL program for some reason, maybe I have been looking at to long? I need to validate that the output in the table will output in a order by the debt_to_income field.

Here is the function code:

 ALTER FUNCTION [dbo].[FN_DTI_BANDS]
(
    -- the parameters for the function here
    @FN_DTI_Band            decimal(4,3)
     )
RETURNS varchar(16)
AS
BEGIN

declare @Return varchar(16)

select @Return =

        Case
        when @FN_DTI_Band is NULL then ' Missing'
        WHEN @FN_DTI_Band = 00.00 then ' Missing'
        When @FN_DTI_Band < = 0.31 then 'Invalid'
        When @FN_DTI_Band between 0.31 and 0.34 then '31-34'
        When @FN_DTI_Band between 0.34 and 0.38 then '34-38'
        When @FN_DTI_Band >= 0.38 then '38+'
        else null end
            -- Return the result of the function
            RETURN @Return
END

Here is the T-SQL test program:

SELECT  loan_number,dbo.FN_DTI_BANDS(debt_to_income)as FN_DTI_Band

from #Input_table

SELECT      COUNT(*), FN_DTI_Band
FROM  #Input_table
GROUP BY FN_DTI_Band
ORDER BY FN_DTI_Band

Here is the error:

Msg 207, Level 16, State 1, Line 7
Invalid column name 'FN_DTI_Band'.
Msg 207, Level 16, State 1, Line 5
Invalid column name 'FN_DTI_Band'.

Can someone help me spot what I am overlooking? Thank you!

  • 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-15T15:21:09+00:00Added an answer on May 15, 2026 at 3:21 pm

    the table #input_table does not have a column called FN_DTI_Band.

    Just the result of the first select statement has that column name.

    You need to make the first select statement a sub query of the 2nd

    Something like this:

    SELECT COUNT(*), T.FN_DTI_Band
    FROM 
    (
       SELECT  loan_number,dbo.FN_DTI_BANDS(debt_to_income) as FN_DTI_Band
       from #Input_table
    ) T
    GROUP BY T.FN_DTI_Band
    ORDER BY T.FN_DTI_Band
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have input checkbox something like this.. <input class=inputchbox id=Pchk type=checkbox name=check value=<%=Model.ID%> />
I have several input and option elements on my page, each (well almost) have
I have input from Form Name,Branch (text) x,y and Total are (number) fields Record
I have a table of non trivial size on a DB2 database that is
I have input tags with a user defined attribute as:- <input name=grp1 type=radio myUDF=value1
I have input <input type=hidden value=Select Value 11121 DataValue name=111 id=222/> I select value
I have input bytes from ffmpeg. I'd like to send this output to several
simple question: I have input fields with inside-labels! Just like the search-box on this
I have a method that have input variable and I need to schedule this
Hi I have a simple form that allows a user to input a name,

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.