Hi,
Can we run a select * query for a production DB2 table??
Please let me know.
Can we run a select * query for a production DB2 table?
-
- Registered Member
- Posts: 15
- Joined: Fri Dec 26, 2014 2:34 pm
- Anuj Dhawan
- Founder
- Posts: 2816
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: Can we run a select * query for a production DB2 table?
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.
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.
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.
-
- Registered Member
- Posts: 15
- Joined: Fri Dec 26, 2014 2:34 pm
Re: Can we run a select * query for a production DB2 table?
Thanks Anuj.
This make it very clear, thanks for the great explanation.
This make it very clear, thanks for the great explanation.
- Anuj Dhawan
- Founder
- Posts: 2816
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: Can we run a select * query for a production DB2 table?
Glad that I had been helpful.
Good luck,
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.
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.
-
- Registered Member
- Posts: 15
- Joined: Fri Dec 26, 2014 2:34 pm
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