Toad: 10.6: Seek clear instructions on automating reoccuring excel reports - sql

I am new to Toad 10.6.1 and have a question about running a SQL script and email data as an excel file on a scheduled basis.
How do I run script and save as excel format and email as excel file to automatically? Thank you for your time.
Below is what I've done so far but dont think its correct as I get "ORA-00911: invalid character" on step #5 .
Select Utilities | Automation Designer menu option
Select DB Misc tab from right side pane
Last icon in this tab is Execute Script, double click on it to add under Action list
Double click on Execute Script 1 action to open it
Select Text radio button and enter query statement or File radio button and point to SQL file (I keep getting "ORA-00911: invalid character" as well)
Under Output pane, designate the Output destination, perhaps a file and if so, provide path and file for output file
Hit Apply and Cancel
Right click on Execute Script 1 action and hit Run. Check the above output path and file to ensure its created
Under utlities I added the email function, but unable to integrate steps 6 & 9 to automate report

When you say "script" are you really trying to export the results of a single query to Excel and then email that? If so, ditch the execute script action. Use the "Export Dataset" action instead which is intended to run a query and export the results to various formats. Execute Script is intended to emulate SQL*Plus functionality and your output is limited to text file.
Drop an "Execute Dataset" action into your app. It's available from the Import/Export tab in Automation Designer.
Double click it to edit its properties.
Select "File" as the output destination and click the "..." button to the right of the filename. Set your filename and choose the .xls file format. Set any other options as you see fit.
Select the Dataset tab and select "Export query." Enter your SQL there.
Apply and Cancel.
Drop an "Email" action into your app following your "Export Dataset" action. It's available from the Utilities tab.
Double click it to edit its properties.
Configure all properties as required for your mail server. *** Note that 10.6 only supports simple mail servers and no SSL/TLS so you can't use your Gmail account or anything like that. It's limiting. Newer versions of Toad support Gmail and the like.
In the Attachments area click "Add File" and specify your exported .xls filename.
Apply and Cancel.
Now when you run your app it will export to XLS and email the file.

Related

Set define off permanent

When running queries in SQL Developer and using the character & in my literals, a popup appears asking me to provide a variable. I then execute SET DEFINE OFF; and I can run my query for the rest of the session.
Is there any way to configure Oracle so it can never ask for manual variables when containing the & character?
Create a text file on your PC which contains set define off and any other set-up instructions you might want.
Then in SQL developer, go to the Tools menu and pick the Preferences... option. In the panel on the left click on Database.
Then either type the path to the file you created, or click Browse and navigate to the file in the 'Select connection startup script' dialog that appears.
That script will then be run every time you connect to any database.
Put SET DEFINE OFF into
login.sql (so that it works for you only, i.e. use user profile file), or
glogin.sql (so that its affect is global, i.e. use site profile file)

How to run code from sql file directly from toad oracle

i have a *.sql file on my desktop. How can i create a job in toad for oracle so that it can directly pick up the file and run it everyday at a specific time.
thank you
What version of Toad? If it's a somewhat newer one, check out the Automation Designer. It's available from the Utilities menu.
Create a new app on the left side, give it a meaningful name
On the DB Misc tab double click the Execute Script action to add it to your app.
Double click the new execute script action and add your file to it. Set other options within as desired.
Click Apply and exit the script action properties dialog.
Right click on your script action and choose Schedule. Work through the Windows Task Scheduler prompts and it will be setup for you.
well different version of the TOAD have different options
the best way i would suggest you is - on the button "Execute as script"
Execute as script --> Execute via SQL plus
then the SQL-plus window will pop up and it will auto connect to your DB.
Gather all your sql queries / script in the file and run below command
#C:\Users\Desktop\script.sql
this will start executing the script from file directly and will give the log in the SQL plus window.

Associate .txt files with VB.NET Program

I created a super basic text editor which can read .txt files. I would like to know how I can set my basic text editor to the default .txt file extension so whenever the user clicks on a .txt file, at first it will show the "default program" window. If the user clicks on my program then the text files will be always opened using my program. How can this be done?
It depends on your version of windows, but in Windows 7/Vista you can click Start->Default programs
http://windows.microsoft.com/en-us/windows/change-default-programs#1TC=windows-7
In Windows XP it's a little more difficult:
Go to the Start menu and select All Programs.
Select Set Program Access and Defaults.
To select an option, click on the radio button beside it.
If you need to expand the option, click on the double arrows for that option on the right side of the window.
http://support.microsoft.com/kb/332003
If you want to do this programatically, you have to edit some registry settings. See here: http://msdn.microsoft.com/en-us/library/windows/desktop/cc144154%28v=vs.85%29.aspx

How to get the SQL query from a file in SSIS

I'm new to SSIS. I have a DataBase from which i'm getting the data. Suppose DB is the source and destination may be anything. (I tried DB to Excel and it worked fine)
In the source i have a custom query to get the data. I have written that in the properties.
Now i want to change it. I want to put it in some configuration file (xml file). i.e., i want to
get the query of the source from the xml file. How can i do this?
I'm a complete newbie trying the things. So please give your answer specifically.
UPDATE:
This is my package
I double clicked the OLE DB source. Now This is what i written there
I want to put the query (select id, age from emp where exp > 4), in a configuration(xml) file.
Create a package level variable for your query:
Change your source editor to use SQL command from variable (with appropriate variable) instead of SQL command:
Go to the SSIS menu and click "Package Configurations..." then click the checkbox to Enable package configurations, then click the "Add..." button.
... By default, it uses an XML Configuration file, which is probably easiest to work with. Specify a filename - the file extension is .dtsConfig. If the file doesn't exist on your machine, it will create one for you. Click Next.
Find your Variable, find the Value property for the variable, and check the box for it. Click Next.
Choose a name for your configuration. Click Done, then click Close in the Package configuration list, making a note of where on your file system you saved your configuration file.
Find the configuration file on your file system. Right-click and edit with an XML editor as needed.

VB.NET call desktop application from 2 shortcuts - supply different parameters

I have a desktop application which reads files from a specified folder, then deposits the files to a folder in a third party document management system based on criteria that the user provides.
My question is:
is it possible to somehow provide different parameters to the code, depending on which shortcut of the application the user clicked on to start it up?
You can add command line parameters to a shortcut icon. Here's how you can do it in Windows:
On the Start Menu, navigate to Notepad.
Right click on Notepad and choose Send To > Desktop (Create Shortcut)
Right click on the newly-created desktop icon and choose Properties
Add your command line parameters to the Target text box.
For example, if you want notepad to open up the hosts file, this would be the content of Target property:
%SystemRoot%\system32\notepad.exe "C:\WINDOWS\system32\drivers\etc\hosts"
You can put pretty much anything into the Target property of a shortcut that you would put into a command line.
Yes.
The easiest way would be to have the shortcut pass those parameters in via the command line.
You could also use conditional compilation variables, and have 2 different .exes. You should be able to find samples of both approaches (command line and conditional compilation variable) in help.