exporting and importing .sql in pgAdmin 4 - pgadmin-4

I'm trying to import a table using pgAdmin 4
I backed up the tables by right click on table, then in menu click on backup, then in Format choice Plain and save file as postgresql_food_table.sql
The back up process ran successfully
I removed the table
I tried to import it back by using Query Tool in Tool tab.
When I tried to execute it, it gives me this error :
Anyone knows what I did wrong?

Related

How to generate Insert statement from PGAdmin4 Tool?

We are writing a new application, and while testing, we will need a bunch of dummy data. I've added that data by using MS Access to dump excel files into the relevant tables into the Postgres database.
What should I do now to generate an Insert statements from the PGAdmin4 Tool similar to what SQL Studio allow us to generate an Insert statements for SQL Server? There are no options available to me. I can't use the closest one, which is to export and import the data via CSV.
I understand that you cannot import the CSV file into the actual DB as this needs to be done through ASP.NET core EF. Perhaps, you can probably create a test schema and import the CSV file into the test schema. Once you have the data imported into the test schema, you can use that to generate SQL statements using the steps below:
Right click on target table and select "Backup".
Select a file path to store the backup. You can save the file name as data.backup
Choose "Plain" as Format.
Open the tab "Options" check "Use Column Inserts".
Click the Backup-button.
Once the file gets generated you can open with Notepad++ or VSCode to get the SQL insert statements
You can use the statements generated and delete the test schema created
Here is a resource that might help you in loading data from Excel file into PostgresSQL if you still need to take this path Transfer Data from Excel to PostgreSQL

SSIS Connection manager issue

I created a Project within SSIS it would take data from a table within a db, do a data conversion and then insert into a Excel spreadsheet. it was working fine with no issues for about a week but now I'm having issues with th e connection manager. I'm getting the data fine from the DB its when it comes to the excel spreadsheet. I have tried doing the project again but still doesn't work. I create a new excel destination within SSIS > a new connection manager go to folder destination and state what I want document to be called. nothing is available from the name of excel sheet drop down and when I select NEW it just closes window. I'm not sure what has gone wrong is it a permissions thing? I have attached screenshot of this and the error when I run application
error when deploy application
i think something must have changed with access to the db. if I use the import wizard and select OLE DB for SQL server as the Datasource nothing is appearing in the server name drop down and If I manual enter it I get an error
Try this:
Step 1) Navigate to Project-> [PROJECT_NAME] Properties.
Step 2: Navigate to “Debugging” option from left panel and from Right panel change Run64BitRuntime value to false.

Database Project in VS2013: `Invalid object name` when trying to create a stored procedure

This is my first time working on a database project, and I'm using Visual Studio 2013.
I simply followed the instruction on Microsoft to create a database project as listed below:
Create a new database project
Clicked Import --> Database and successfully imported tables
Clicked Add --> Stored Procedure...
However I keep getting this Invalid object name 'TABLENAME'. message for any tables I've imported.
I've tried Use DATABASE_NAME; but it did not help.
Also I've read about refreshing IntelliSense but I do not get the refresh option in VS2013. Plus, it's not just the IntelliSense because I still get the same error when I manually type in the table name.
Even if I create a stored procedure directly in SSMS and then try to run it, I still get the same Invalid object name error.
Any help is appreciated very much.
The problem was that I didn't change the connection setup to use the correct database server (I was using the local one).
Right click the database project --> Properties
Click Debug
Under Target Connection String, click Edit and select the correct database server
Create a new stored procedure (I've tried up to STEP3 but my problem was that I was not testing on a new stored procedure after changing the connection setup)

How to Save Query to another database in Aqua Data Studio

I am new to aqua data studio and have multiple databases when logging in. im running a query in another database and want to save it to another database and cant figure out where to do this. can i script this in my query or where can i go in the interface to do this?
Save your query in Database 1 as a .sql file
Open a query window to Database 2 and Open the file and execute.
Another option would be, in the Tree Node, navigate to the Files Tab. Under the Files tab, right click on FileSystem and then Mount the directory containing your saved SQL scripts. You can then select the saved sql file and the right click and use the Open in Current Window or Open in.. to execute the query in the Database you want.

Importing a CSV file without headers into SQL 2008

I want to import a CSV with 4,8M records into a SQL 2008 table. I'm trying to do it with the Management Studio wizard but it keeps trying to recognize a header row which the CSV doesnt have. I don't find any option to skip this and although I specify the columns myself, the wizard still tries to find a header row and doesnt import anything without it.
The structure of the CSV is
"818180","25529","Dario","Pereyra","Rosario","SF","2010-09-02"
I've also tried alternatives like BULK INSERT but then I find out that with BULK INSERT I can't import files with a text qualifier.
The easiest way for a one time import would definitely be the "Import Data" function in SQL Server Management Studio. This will launch a wizard and will allow you to define where you want to import your data from - pick "Flat File Source". The next dialog allows you to browse for the file you want to import, and you can specify all sorts of things on that dialog (like the encoding of the file, what the text qualifier is - if any - and so on.
You can also select to skip any number of rows (e.g. "skip the first 5 rows"), or you can select that the first row has column names.
If your file does not have the column names in the first row, uncheck that option.
If you need to do this import over and over again, you can save all the information about the import as a Integration Services package in SQL Server (or in an external SSIS file), and you can then run that import again and again from the SQL Server Agent "Jobs" menu (enable SQL Server Agent, if you haven't already, and find the "Jobs" sub-item - you should see all your jobs under there and you can launch them again from that menu).
And if you want to, you can also launch these SSIS packages from your C# or VB.NET code - check out this CodeProject article or see Michael Entin's blog post on the topic.
Uncheck "first row has column names"
http://epicenter.geobytes.com/images/MsSqlI006.gif

Resources