Can we run a select * query for a production DB2 table?

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Abhishek Mehta
Registered Member
Posts: 15
Joined: Fri Dec 26, 2014 2:34 pm

Can we run a select * query for a production DB2 table?

Post by Abhishek Mehta »

Hi,

Can we run a select * query for a production DB2 table??

Please let me know.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Can we run a select * query for a production DB2 table?

Post by Anuj Dhawan »

You "can' use it, however it's not recommend in static SQL. SELECT * is recommended mostly for use with dynamic SQL and view definitions.

You can use SELECT * in static SQL, but doing so is not recommended because of first, possible host variable compatibility and performance implications. Suppose that you add a column to the table to which SELECT * refers. If you have not defined a receiving host variable for that column, an error might occur, or the data from the added column might not be retrieved.

If you list the column names in a static SELECT statement instead of using an asterisk, you can avoid problems that might occur with SELECT *. You can also see the relationship between the receiving host variables and the columns in the result table.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Abhishek Mehta
Registered Member
Posts: 15
Joined: Fri Dec 26, 2014 2:34 pm

Re: Can we run a select * query for a production DB2 table?

Post by Abhishek Mehta »

Thanks Anuj.

This make it very clear, thanks for the great explanation.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Can we run a select * query for a production DB2 table?

Post by Anuj Dhawan »

Glad that I had been helpful.

Good luck,
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Abhishek Mehta
Registered Member
Posts: 15
Joined: Fri Dec 26, 2014 2:34 pm

Re: Can we run a select * query for a production DB2 table?

Post by Abhishek Mehta »

Thanks Anuj!
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”