SQL QUERY

Ask question on - DataBase Concepts, IBM Mainframe DB2, DB2/UDB, DB2 Tools, SQL , DB2 programming with languages like COBOL, PL1.

Moderators: Kalicharan, Moderator Group

Post Reply
sreekanth1984
Member
Posts: 12
Joined: Mon Oct 12, 2009 12:41 pm

SQL QUERY

Post by sreekanth1984 » Tue Mar 09, 2010 3:44 pm

Hi All:

Can any one give me SQL query that retreives the rows/records for first two columns with out specifing the column names in the query?

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Fri Apr 16, 2010 10:58 pm

interesting question...
you may need to use sysibm.systables in subquery...
Natarajan
Chennai

karthik5stars
Member
Posts: 1
Joined: Tue Aug 24, 2010 10:39 pm
Location: Chennai

Post by karthik5stars » Tue Aug 24, 2010 10:52 pm

it may help u guys.....

SELECT * FROM table_name WHERE ROWNUM <= 2;

it worked in oracle but am not sure it is for DB2... :shock:
Life is Simple.....Dont Complicate it!!!!!!!!

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Aug 25, 2010 2:22 am

karthik5stars,

you are selecting all columns
which does not satisfy the TS's requirements.

Please read and fully understand the question before you provide a solution.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Ferrari2010
Member
Posts: 7
Joined: Sat Oct 02, 2010 10:29 am

Post by Ferrari2010 » Fri Oct 08, 2010 9:23 am

Hi,

Can you try..

SELECT 1, 2 FROM table_name.

Thanks,

Ferrari2010
Member
Posts: 7
Joined: Sat Oct 02, 2010 10:29 am

Post by Ferrari2010 » Fri Oct 08, 2010 9:30 pm

Please ignore above,

I tried and it is not working.

Thanks,

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others