My bet is that it doesn't matter. And because of this, I would code it so that it makes the most sense to the developer tasked with maintaining the code later.
I say it probably doesn't matter because the needed, underlying SELECT function is the same either way. Besides the SQE frequently will re-write your query to optimize execution anyway.
That said, I tend towards using SET for the retrieval of a single value (even though it can accept and assign more than one column). And I'll use SELECT...INTO when retrieving more than one column.
Again...primarily to allow for intuitive understanding of the code by a future developer performing a maintenance task.
Steve Needles
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of David Gibbs
Sent: Friday, July 28, 2017 11:36 AM
To: midrange-l@xxxxxxxxxxxx
Subject: SQL: VALUES ... INTO vs. SET
Folks:
Any thoughts on if it's better to use the SQL construct 'VALUES ... INTO' or 'SET' to assign a value using a SQL function?
Thanks!
david
--
IBM i on Power Systems: For when you can't afford to be out of business!
I'm riding a metric century (100 km / 65 miles) in the American Diabetes Association's Tour de Cure to raise money for diabetes research, education, advocacy, and awareness. You can make a tax deductible donation to my ride by visiting
https://mideml.diabetessucks.net. My goal is $6000 but any amount is appreciated.
You can see where my donations come from by visiting my interactive donation map ...
https://mideml.diabetessucks.net/map (it's a geeky thing).
I may have diabetes, but diabetes doesn't have me!
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
CONFIDENTIAL: The information contained in this email communication is confidential information intended only for the use of the addressee. Unauthorized use, disclosure or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by return email and destroy all copies of this communication, including all attachments.
As an Amazon Associate we earn from qualifying purchases.