Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to enclose a list of values into single quotes for SQL query - Use Microsoft Excel

Many times you get a list of values which you want to check in the Database to confirm if they exist in your tables or to get more information bout them. For example, you got a list of 100 stocks and you want to check their last day closing prices in the database. The problem arises when values to be searched are Strings e.g. VARCHAR or CHAR because VARCHAR values need to enclosed in the single quotes in most of the database e.g. SQL Server, Oracle or MySQL. If number of values are less than 5 then it make sense to add single quotes around them and separate them by comma manually so that you can use then on IN clause of your SQL query, but if it's more than 5 e.g. 50 or 100 then manually enclosing them into single quotes will take a lot of time and most importantly programmers are not supposed to do such silly stuff manually.
Read more »


This post first appeared on Javarevisited: Blog About Java Programmin, please read the originial post: here

Share the post

How to enclose a list of values into single quotes for SQL query - Use Microsoft Excel

×

Subscribe to Javarevisited: Blog About Java Programmin

Get updates delivered right to your inbox!

Thank you for your subscription

×