I need to import files to SQL Server, but I cannot become Bulkadmin.
I can use the Import Flat File Wizard on a particular Microsoft SQL Server. But I cannot use BULK INSERT statements. I get an error: "You do not have permission to use the bulk load statement."
What SQL statements does the "Import Flat File Wizard" use to import files. It cannot be bulk insert, so how does the wizard do it.
I will add an import to a stored procedure, that is running as a job each evening.
The "Import Wizard" creates and executes an SSIS package behind the scenes.
Related
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
I have to weekly upload text files from a server location to Microsoft SQL Server Management Studio .I wish to automate the task so that files are automatically uploaded .Can somebody suggest me the way?
Methods I know of:-
Via SQL:
Use OPENROWSET to open the file and obtain the records to write into
a table.
Use BULK INSERT to open the file and insert directly into a table (you may need to pair with XP_CMDSHELL to get a directory listing to loop through)
VIa SSMS:
Create a DataFlow to import from file
SSMS makes it easier to do clever things with the import process. But it can be very finnicky.
With both of those you can set up an Agent job to run the script / package automatically.
I have around 1000 text files that need to be imported as tables to MS SQL Server. Usually I use Import and Export Data Tool, but doing that a 1000 times would be insufficient.
Is there a way to automate the process and import the 1000 text files and create the tables in SQL without doing that manually? Can that be achieved using a script?
Use SSIS. Start with your export package saved to the file system. In SSDT create a new SSIS project. Delete the Package.dtsx file created with the project. Right click the Packages "folder" and select Add Existing Package, navigate to the package you saved and select it. Now you can start automating the loads.
This is an assignment. I have to import a .sql file into MS Access. The file preferably will be NorthWind Database (.sql file). I have downloaded one from:
https://northwinddatabase.codeplex.com/releases/view/71634
and it contains a .sql file.
What to do next?
(Please note that importing/connecting MS Access from/to MS SQL Server through ODBC is irrelevant to this problem. The problem is to import a generic .sql file)
That's plain impossible without a major rewrite, and I seriously doubt if that is the assignment given to you.
The SQL for download is in T-SQL for building the complete database in SQL Server.
The Nortwind database is for download in an Access version if that is what you need.
You are going to have to rewrite it, but you should be able to open it with any text editor like notepad. Then you can copy and paste it into the sql view in the query designer.
Given the DAT file and the DDL file for each table in a DB2 database, can I import this data to SQL Server? I have no access to the original server or any copy of a DB2 server so connecting to a live instance isn't an option.
Can I do this without a live instance of DB2 or should I go back to the client and ask for CSV files? Is there a procedure or tool that makes this process smoother? I've tried to find a file-based connection string to use to connect to a set of DB2 files with no luck. I've also tried SwissSQLDB2ToSQLServer and SqlLinesData to see if they have a file-based option built in.
OK, given the comment above, you can't import DB2's container files (DAT, LRG, or anything else) directly. You need a CSV or equivalent. Yes, one way to get this is run the EXPORT utility on a live DB2 database. HTH!