SQL Query output cannot be exported to a CSV file - export

Hello I currently working with a SQL dump in Datagrip. I just wrote a SQL Query which I want to export to a CSV file unfortunately I get a error message if I try to export it the export error message as follows says:
Cannot write file: /home/NAME.csv
An hour before I successfully exported a Query with no Problems. I didn't changed a thing in the Database except for adding another table. The Table was created as a help table to write an SQL Query on the former Query
Maybe someone encountered the Problem before and there is a easy way to solve. If additional Information is needed please let me know.
Thanks.

Related

Error while trying to create table in MSSQL using flat-file import

I am trying to import a .csv file to SQL Server Native 11.0 in order to create a table.
However, I am getting the following error:
Warning 0x80070020: Data Flow Task 1: The process cannot access the file
because it is bein gused by another process.
Error 0xc020200e: Data Flow Task 1: Cannot open the datafile
Following the the .csv data:
Need help in figuring out the solution for these errors.
Issue: This was happening because I have opened the .csv file in excel and at the same time I was trying to import it to SQL Server.
Solution: Try closing the file before importing. It should work then, as it worked for me.

SSIS failure flow in SQL Job history

I have an SSIS solution that inserts content of .csv files into my database. The happy path scenario works great. However, some of the database fields are required. If I, for example, let my solution load an empty .csv file with not nullable fields in the database, the solution will fail, ofcourse. I have used the SSIS failure flow to put these files into a seperate folder. This works fine. When the package finishes, the package finishes and says it completed with errors. This translates to a failed job in the SQL Server agent. The job however did exactly what I wanted: process the valid files and archive the invalid files.
My question is, is there any way I can tell SSIS it's done the right thing and it shouldn't return an error on finish?
Thanks in advance. I hope someone can help me.
From Agent Job you can try, In the Job Step Properties dialog box, select the Advanced page
OR
You can ignore the failure from the OnError property of the task:
You can also go to the task that is causing the package to fail, and change its FailPackageOnFailure property to "False".

Errors while importing data from flat file to database table

I got these error message while importing data from flat file to sql server table using import export wizard in ssms :-
The mapping window :-
I know there is a issue regarding datatype mismatch,how should I overcome that?
As per error, it indicate that your flat file is not in proper format, in file some of the row has messing (, or tab) delimiter.

Import flat file into SQL Server

I'm trying to import a flat file into SQL Server and I'm having some issues. The column delimiter is ;~ and the row delimiter is |~. I'm using the SQL Server Import and Export Wizard but keep getting errors. Have any of you every had a similar issue? I think I'm doing it wrong from the start of the wizard. Can any of you talk me through the steps. Thanks.
Here is the import error:
It's a familiar-sounding problem, but difficult to be sure without a data file to play with - perhaps one of these posts has your answer:
Text was truncated or one or more characters had no match in the target code page including the primary key in an unpivot
Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column
SQL Server Import wizard fails with incomprehensible message
Thanks to all of you who responded.
My solution was to first create the tables in SQL Server using the varchar(max) data type for each column and then executing a BULK INSERT statement. Definitely not ideal, but the goal was not to create a database but rather delimit the data so I could upload it to an application. Thanks again.

SQL Server Import from XLS cant convert Double to int/bit

So I exported an sql database out as an excel file so that I could send it off to be edited by hand. I used the Microsoft SQL Server Management Studio then the SQL Server Import and Export Wizard to do so. Now the edits are finished and when I go to reimport the file I get
Found 7 unknown column type conversion(s)
You are only allowed to save the package
And it wont let me run the import. It seems to me as though the export to excel converted all int and bit datatypes into Double datatypes and It doesn't know how to convert back. I did a bit of googling and I found the SSIS10ToMSSQL.XML file (which appears to control how the conversion takes place), but I don't know how I should edit it to tell the wizard how to convert correctly.
Any input on this problem would be appreciated.
After WAYYYYYY to many hours spent trying other formats and settings, I just bit the bullet and wrote a console app to read in a csv (exported from excel) and run the necessary SQL on the database.

Resources