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

  • Home
  • SEARCH
  • 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 898377
In Process

The Archive Base Latest Questions

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

I am writing a T-SQL program over a DB2 database on a LINUX box

  • 0

I am writing a T-SQL program over a DB2 database on a LINUX box (DB2/LINUXX8664) using a linked server. I think the DB2 is Version 9.5.3 but not certain. I am receiving an error that I feel is likely a DB2 issue as the syntax checks out okay in T-SQL. This is the code:

IF(SELECT(OBJECT_ID('TEMPDB..#TempFile))) IS NOT NULL DROP TABLE #TempFile

SELECT        *

INTO  #TempFile
FROM  OPENQUERY(LinkedServer, '

SELECT  F.LOAN_NUMBER,

   (SELECT 
    SUM(EXP_CHILD_CARE_AMOUNT) + SUM(EXP_FOOD_AMOUNT) + 
    SUM(EXP_LIFE_INSURANCE_AMOUNT) + SUM(EXP_TRANSPORTATION_AMOUNT) + SUM(EXP_TUITION_AMOUNT)+
    SUM(EXP_USER_1_AMOUNT) + SUM(EXP_USER_2_AMOUNT) + SUM(EXP_USER_3_AMOUNT) + 
    SUM(EXP_UTILITIES_AMOUNT)
    FROM FINANCIAL F)
       AS ExpenseTotal,

    (SELECT
     SUM(MORTGAGOR_NET_PAY_AMOUNT) + SUM(MORTGAGOR_OTHER_INCOME_AMOUNT) AS IncomeTotal 
     FROM FINANCIAL F   
      INNER JOIN BDE.LOAN_V a ON F.LOAN_NUMBER = A.LOAN_NUMBER)
     WHERE A.FIRST_PRINCIPAL_BALANCE> 0
        GROUP BY F.LOAN_NUMBER 
        ORDER BY F.LOAN_NUMBER,   


FETCH ONLY WITH UR ')

Here is the error:

OLE DB provider “MSDASQL” for linked server “LINKEDSERVER” returned message “[IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token “A” was found following “BER) WHERE”. Expected tokens may include: “FROM”. SQLSTATE=42601
“.
Msg 7350, Level 16, State 2, Line 4
Cannot get the column information from OLE DB provider “MSDASQL” for linked server “LINKEDSERVER”.

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

    The first thing I notice is that you have a naked query, which is not uncommon in Microsoft SQL Server. A simplified version of your linked query looks like this:

    SELECT (subquery), (subquery) WHERE ...conditions...
    

    In DB2, you must have a FROM clause in any query. Microsoft and some other SQL vendors permit a SELECT with no FROM clause, but this isn’t standard SQL. In this case, DB2 conforms to the standard.


    Second thing I notice:

    IF(SELECT(OBJECT_ID('TEMPDB..#TempFile))) IS NOT NULL DROP TABLE #TempFile
    

    Do you need to close that quoted string?

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

Sidebar

Ask A Question

Stats

  • Questions 489k
  • Answers 489k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer not possible......... May 16, 2026 at 8:56 am
  • Editorial Team
    Editorial Team added an answer What you really care about is whether the shortest difference… May 16, 2026 at 8:56 am
  • Editorial Team
    Editorial Team added an answer Good question, this bothers me too. I googled it and… May 16, 2026 at 8:56 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm writing an application for the iPhone that communicates with a SQLite database but
In this program I'm writing, it would need frequent database communication, and at the
I have a Sql Database (which I have no control over the schema) that
I'm in the process of swapping over a database for a rewrite of my
I have a very dynamic SQL Server problem to solve. I am developing a
I'm trying to run an NHibernate over sqlite. i have two projects: 1. Orange.Database
First a bit about the environment: We use a program called Clearview to manage
I have a single windows shell command I'd like to run (via EXEC master..xp_cmdshell)
Here are the relevant technologies that I'm working with: Devart's dot Connect for Oracle

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.