Excel Data values returned as null when load to SSIS - sql

I have an odd thing happening with importing data from Excel to SQL Server.
This is my sample source data
The value become null after import to SQL Server
Basically, other part of excel work well. But only for this area, the value become null. The data type is float which I haven't convert it to numeric or nvarchar.
Thank you for your help.

Related

PowerQuery ODBC Connection - DataSource.Error: decimal value out of range - SQL Query

I created a ODBC connection through PowerQuery. The value column is causing the following error:
DataSource.Error: The ODBC driver returned a decimal value for column X, that we couldn't understand or is out of range.
It seems that the errors are caused mostly by values of around 0 with more than 6 decimal when the data is loaded directly to PowerQuery. If I load the connection directly to an excel table, there are no errors.
The SQL code I am using is simply selecting the desired columns with couple of conditions (SELECT, FROM, WHERE). I am not adept with SQL yet.
Is there a some kind of Format or Rounding I can apply to the selected value column directly in the query so that the data is transformed in a format that PowerQuery is able to read before being loaded to PowerQuery?
Or any other possible solutions to fix this error?
Any input is appreciated.
Thank you.

SQL Convert from alphanumeric to numeric only

Ok, I have a table I am querying for an outside project. The table has a field that is alphanumeric but the external project can only support numeric data. The outside project is needing my data as an Excel spreadsheet so I am trying to just export my query to Excel which I can do but I can't seem to figure out if there is a simple convert feature to do this for me. The originating table has the field as VARCHAR(10). I tried CAST and CONVERT but no go. This is SQL Server 2012.
Thanks.

Datatype for a column with both numbers and text in SQL Server?

I am exporting data from Excel to a SQL Server table using SSIS. I have a column in Excel which contains numbers and text.
What is the best datatype that I could use in the created table in SQL Server for this column to make the export of data smooth?
The reason that I am asking this is because I tried the data transformation and only the data with numbers in the above mentioned column got loaded properly.
BTW I used nvarchar(255) for the above column.
Thank you
Edit: My table kind of looks like this
The rows with text in col3 and col4 are not copied into the table
If your excel column contains combined values of characters, numbers and alphanumeric, add IMEX=1 to the extended properties of excel connection manager.
https://www.youtube.com/watch?v=s3d-XIYuB7k
Thanks

Importing from Excel to SQL Server: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

I have the following Excel Workbook:
https://meocloud.pt/link/7cb3ef48-7556-4d36-ab9a-c247d3f7b29d/FichasTeste.xls/
It's formatted to be imported to a SQL Database. The server has the following details:
As you can see the mapping is correct in the importer
When i try to import the excel file, the status is always the same, no matter the modifications i do to the columns with the Date.
242: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
3621: The statement has been terminated.
What should i modify so that those rows can be imported without having that error?
Excel stores dates as integers, if you change the excel field to TEXT you'll see that, but I'm not sure why you're having this problem, you should be able to direclty import from Excel and have dates preserved, at least you can using SQL's import wizard as well as SSIS.
One workaround is using the TEXT() function in Excel to get your date into an acceptable format:
=TEXT(F2,"yyyy-mm-dd")
I like importing from Excel using OPENROWSET(), but that requires some additional setup and has it's own drawbacks:
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=C:\YourExcelFile.xls', [Sheet1$])

INT Inserted in SQL as NULL SSIS Package Excel to SQL

I have setup an SSIS package to take data from an excel file, and insert it into SQL.
The package takes the data from Excel, performs some Data Conversions, and then Inserts it into my SQL DB.
One of the columns in excel contains both text, and ints. Typically the values will be either: W2 or 1099.
In the data conversion data flow, this column is converted to: string[DT_STR], length: 50, Code Page: 1252 (ANSI - Latin I)
in SQL, the field it is going to is configured as a varchar(50).
For any row, where the column value in Excel is 1099, the data inserted into SQL, comes through as NULL.
I have no idea what could be causing this. I have similar conversions in other packages, that come through with no issues.
i have tried formatting the column in excel as text as well as re-creating the data conversion, with no luck.
Any suggestions of ways to get this to work properly appreciated. Please let me know if you need any additional information.
Is the data NULL in the Excel preview? You need to isolate whether this NULL is being provided by the Excel driver.
Anyway this sounds like the old IMEX=1 issue that has been around since forever.
http://microsoft-ssis.blogspot.com.au/2011/06/mixed-data-types-in-excel-column.html
Try adding IMEX=1 to your Excel connection string.