I have a excel table as below. I want to output the table below with "SQL Query" column as .sql. can you please help how to achieve this
Input
Code | SQL Query |
123 | SELECT Orders.OrderID, Customers.CustomerName FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID; |
I am doing a output file as "123.sql"
when I open the "123.sql" file I am getting the column heading and the codes are inside a " " like below. How can I get "123.sql" file without the "SQL Query" and without the Quotes " "
SQL Query "SELECT Orders.OrderID, Customers.CustomerName FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID;" |
Solved! Go to Solution.
@Lumjing Try mirroring this configuration in the Output Data Tool...
@PhilipMannering is there a way to align the query in the output it is coming as one line when I open the .sql file.
Thank you for the quick help.
switch the delimiter to \N in the input config
@Lumjing And if that doesn't work, use Split-to-Columns tool to split your text field into rows on a "\n". Example attached.
@PhilipMannering thank you for the option. The "SQL Query" in my case is in line and when I use the \n it does not split them in rows. can you please suggest any alternatives
@jdminton I switch the delimiter to \n and the output is "SELECT Orders.OrderID, Customers.CustomerName FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID;"
@Lumjing I think what you are asking is for a way to format the code so that it is more readable. There's no default for this as each coder has his or her own preferences. You can try what I've included in the No New Line container in the workflow. I've added my first explanation as well to what Philip provided. There would be lots of parsing to get this how you want based on the SQL commands used within the code. You might consider using a different tool to help with this. I use Flyspeed SQL Query tool to help with formatting or developing complex SQL queries. I believe the free version will perform the formatting you are looking for. Please confirm if that is your question. Thanks..
@jdminton Thank you for the detailed description. I will check and update. Can you please share me the .txt files