How to import a schema sql file using pgadmin 4? - sql

Is it possible? If so how?
I can only find solution for pgadmin 3 which doesn't work for me.

It worked like this for me:
Go to your Database and click on this.
Click in the menubar on Tools, Query Tools
Then it reload the page. Above the menubar on the left, you see the folder-icon (look picture below). Click on them and choose your .sql file
Click on select and the file is uploaded
To execute the .sql file, press F5 or the play button above the menubar in the middle (look at the screenshot below).
Right click on your database and click on 'Refresh'.

Following are the step that will help you in importing all tables of your schema
1) Open pgAdmin 4
2) Navigate to Your Database Name --> Schemas --> public
3) Then right click on public
4) After clicking on public then select Restore option from DropDown Menu
5) A window will open in which you only have to give location of .sql file and leave other textboxes
6) Click Restore and leave rest on pgadmin
Note :
You have to perform these steps for every single table you want to import

To handle this problem, follow these steps:
Select your Database.
Click in the menubar, select Tools & Query Tools,
Import your SQL (to generate query create table)
Execute query

this steps:
To handle this problem, follow these steps:
Select your Database.
Click in the menubar, select Tools & Query Tools,
Import your SQL (to generate query create table)
Execute query
This working with me when importing .sql file after creating the database.
Thanks

Related

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.

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

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.

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.

Use the same file in more than one solution

Just wondering whether it is possible to used a single form into more than 1 solutions?
I have frmbookstock.vb in solution A and i need to use frmbookstock.vb in solution B as well. So every time i change the content of the frmbookstock.vb, both of the solution will received the update as well.
I have tried to import it to another solutions, but it will create a new file under the new solution.
Yes you can.
In Visual Studio go to the folder that you want to add the existing item to.
Right click and Go to "Add".
Select "Existing Item".
Select your file.
IMPORTANT STEP: Select the little dropdown arrow next to the "Add" button.
Select "Add as Link" instead.
This will place a link to the original file in the source folder.
So now you have two Visual Studio items in different projects that point to the same, real, file on your hard drive.

Customize Sql Server Object Explorer Right Click Menu Items

How can I add or customize right click menu items in object explorer in Sql Server 2012?
for example I wanna add new items to table right click menu for generate my customize table creator script?
You could write an SSMS add-in.
See
http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/15/building-a-sql-server-management-studio-addin.aspx
http://www.ssmsboost.com/create-own-ssms-2012-add-in-sample-code-with-download
I'm working on a project at Red Gate to open up our SSMS extensibility code. It sounds like it's exactly what you need and it's more straight-forward than interacting with SSMS directly.
There's a developer guide here: http://www.red-gate.com/ssmsecosystem/developerresources