Archive

Archive for October, 2011

Generate SQL queries from Excel document

October 28th, 2011 1 comment

Hi All,
Long time no see, eh?!
That’s what happens when you start working for utilization targets..
When the business needs some Excel to be processed through a database in a certain manner I tend to save lots of time by generating the SQL queries automatically inside the Excel document.
Example:
You have an Excel document that depicts table structure inside your database. the Excel document contains the latest updated by the business version of some variables that should be updated inside your database. (Here many of you will ask the logical question, who does stuff in such a rigid and obsolete way? And I have nothing to say in my defense)
What I do is to pickup the important columns that form my query and generate in in a free columns on the right hand side.
="update table_name set colum_name_1="&F2&" where column_name_2='"&A2&"' and column_name_3='"&C2&"';"

For F2=5, A2=STRING1, C2=STRING2 the result will be the following:

update table_name set column_name_1=5 where column_name_2='STRING1' and column_name_3='STRING2';

Read more…

Categories: Database, mysql, Oracle Tags: