I have a pipeline which runs sql counts everyday as part of regression testing, I would like to be able to export the results of each build into an excel document where the results can be stored and compared, is this possible?
Thanks in advance
Related
I am using Toad for Oracle 14.2 database it
I have an sql script which checks duplicates and not nulls in various columns (and tables) and returns a count of rows if nulls or duplicates exist.
This data integrity test script is run every two weeks. The script is written in a way that the results of the query are spooled into a text file in a shared folder.
I wish to automate it and schedule its run every two weeks.
I know this can be done in a crontab using Linux.
But I would like to know how could it be achieved using POWER BI with a scheduled refresh
Thank you
This is super-easy in Power BI, once you get the Oracle drivers installed on both your dev environment and on the On-Prem gateway you set up.
This would simply be an import mode Dataset with a custom SQL Statements and a scheduled refresh.
You may have to break the script up into multiple queries in Power Query. If they all return the same columns you can merge them into a single table in the Power BI model.
I have worked in SAS for much of my career and always found it easy to write a dataset out to csv using a proc export. I now am working in SQL Server and am not finding any similar functionality. Everything I find on the web refers to copy/paste the data into excel or using an export wizard. I don't like those options as the end goal is to automate this query and have the data output where it can be utilized by other programs. Is there any code based way to achieve this?
Are you using SSMS? CTRL-T then execute your query, you'll get a text (csv) result. Alternatively, Query -> Results to -> Results to Text. Alternatively, you can right click the results grid and select Save Results As
For automation, you can use SQL Server Agent to schedule a job the writes the output of a query to a file.
There are 8 separate queries I need to run and save to individual excel files. What's the best way of running this in toad rather than executing/saving each query?
Just figured out how to do this and I'm posting so that anyone else with the same problem can look at this as a possible solution.
Use the Automation Designer feature in TOAD for Oracle. Select export dataset and write in your query that you want exported and into what format you want it exported (I chose excel file). Repeat this process for all your queries. Select all "actions" and run.
This is my first job creation task as a SQL DBA. First step of the job runs a query and sends the output to a .CSV. As a last step, I need the job to execute the query from the .CSV file (output of first step).
I have Googled all possible combinations but no luck.
your question got lost somehow ...
You last two comments make ist a little clearer.
If I understand it correctly you create a SQL script which restores all the logins, roles and users, their rights etc. into a newly created db.
If this created script is executable within a query window you can easily execute it with EXECUTE (https://msdn.microsoft.com/de-de/library/ms188332(v=sql.120).aspx)
Another approach could be SQLCMD (http://blog.sqlauthority.com/2013/04/10/sql-server-enable-sqlcmd-mode-in-ssms-sql-in-sixty-seconds-048/)
If you need further help, please come back with more details: What does your "CSV" look like? What have you tried so far?
I need to export the data from a particular table in my database to Excel files (.xls/.xlsx) that will be located into a shared folder into my network. Now the situation is like this -
I need to use SQL SERVER Agent Jobs.
2.I need to generate a new excel file in every 2 minutes that will contain the refreshed data.
I am using sql server 2008 that doesn't include BI development studio. I'm clueless how to solve this situation. First, I'm not sure how to export the data using jobs because every possible ways I tried had some issues with the OLEDB connection. The 'sp_makewebtask' is also not available in SQL 2008. And I'm also confused how to dynamically generate the names of the files.
Any reference or solution will be helpful.
Follow the steps given below :
1) Make a stored procedure that creates a temporary table and insert records to it.
2) Make a stored procedure that read records from that temporary table and writes to file. You can use this link : clickhere
3) Create an SQL-job that execute step 1 and step 2 sequentially.
I found a better way out. I have created a SSIS(SQL Server Integration Services) package to automate the whole Export to Excel task. Then I deployed that package using SQL Server Agent Jobs. This is a more neat and clean solution as I found.