There are situatuion where we have data in excel sheet and we need to generate SQL corresponing to each row of excel sheet .
Example: Consider this data which we have in excel sheet.
We have four column of a table say table1 and we want to generate sql to insert these data in table1.
We will use excel feature to generate Sql.
We are Going to use concatenate command which conactenate two strings. COMMA (,) is operator which concatenate two string .For example: =concatenate("ram is "," a good boy");operator , will concatenate these two string ram is & a good boy .So if want to concatenate cell A2 & B2 then we will write =concatenate(A2,B2) & it will result in concatenating the values of cell A2 AND B2.
For our case we will try to write like this :
=CONCATENATE("Insert into table1 values('",A2,"','",B2,"',",C2,",'",D2,"');")
("Insert into table1 values('" --->this is one string and it should be concatenated by value of A2 cells followed by single quote which we will get concatenate in next string.
"','" -->This is nothing but we are ending charachter field with quote, inserting a comma (not the operator one)starting a new quote for the next char col and ending the string with double quote.After we generate the command we populate the same thing for each column
Result will look like this.It is useful in case we have a lot of data in excel.