Allen Pitts
asked on
DB2 SQL syntax
Good moruing expert,
I have several years with T-SQL (MS SQL Server) and some time with PL/SQL (Oracle).
Today is my first day with DB2. Is there a knowledged domain that is equivalent to DB2
that is the same as T-SQL is equivalent to MS SQL Server? If, so what is called?
This query will work in MS SQL Server
SELECT "CASE".CASE_ID,
"CASE".CLIENT_CD,
"CASE".CONTEXT_CD,
"CASE".STATUS,
"CASE".PROGRAM,
"CASE".CASE_NUM
FROM PIER."CASE"
where CLIENT_CONTEXT like 'PIERHIPPMA'
But in DB2 it returns 'DB2 Datasbase Error [42703]'.
What is the problem?
Thanks.
Allen in Dallas
I have several years with T-SQL (MS SQL Server) and some time with PL/SQL (Oracle).
Today is my first day with DB2. Is there a knowledged domain that is equivalent to DB2
that is the same as T-SQL is equivalent to MS SQL Server? If, so what is called?
This query will work in MS SQL Server
SELECT "CASE".CASE_ID,
"CASE".CLIENT_CD,
"CASE".CONTEXT_CD,
"CASE".STATUS,
"CASE".PROGRAM,
"CASE".CASE_NUM
FROM PIER."CASE"
where CLIENT_CONTEXT like 'PIERHIPPMA'
But in DB2 it returns 'DB2 Datasbase Error [42703]'.
What is the problem?
Thanks.
Allen in Dallas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent answer. It works.
ASKER
Is there a name, like T-SQl or PL?SQL for the language used to query DB2?
SQL. :)
Like most DBMS, there are two SQL languages. (Some have 3 or more.)
Most database clients allow some version of SQL through a native, ODBC, or JDBC driver. Procedures have an extended language. In DB2 it's called PL/SQL.
http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.apdv.plsql.doc/doc/c0053607.html
None of the DB2 clients incorporate the declarations and variables into the client environment like SQL Server does. And Oracle's SQL*PLUS is an animal all unto it's own.
Kent
Like most DBMS, there are two SQL languages. (Some have 3 or more.)
Most database clients allow some version of SQL through a native, ODBC, or JDBC driver. Procedures have an extended language. In DB2 it's called PL/SQL.
http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.apdv.plsql.doc/doc/c0053607.html
None of the DB2 clients incorporate the declarations and variables into the client environment like SQL Server does. And Oracle's SQL*PLUS is an animal all unto it's own.
Kent
ASKER
Thanks
It's generally a poor design that has tables and/or columns named such that any of them require quoting because they use a reserved word. It's certainly legal, but it causes the kinds of problems that you're seeing now.
And welcome to DB2. You'll like it. :)
Kent