"value too long for type character varying(100)" knowing column using npgsql - npgsql

getting error "value too long for type character varying(100)" but i am not getting column name in which this error is occuring,
I am using postgress sql as db and EFcore foe inserting the data in DB
how can we use logs using npgsql so we can know the coumn and its value which is causing error.

Related

String or binary data would be truncated. The statement has been terminated. Asp.net

I am getting this error in spite of declaring every column datatype to max
This is my code I'm just logging my exceptions to the db
Desgin of my table,(I use ssms 2014)

Changing datatype in MS Access table producing error message

I am trying to change the datatype of a field in a MS Access table. I want to change it from Long Integer to Single but Access keeps giving the error message:
Operation is not supported for this type of object MS Access.
Access will only accept Long Integer. All the other Number types namely: Single, Integer, Double, Byte, Decimal, Replication ID are producing this error message.
Could this be a setting that has been implemented on the database? I should mention that the table I am using is a SQL Server (not sure what this means but my data team changed it to SQL Server for efficiency reasons I presume) but before it was an ordinary table and changing datatypes did not produce any error messages.
I have tried changing the datatype in design view and it is not working. I have also tried to change it in datasheet view -> fields tab -> properties group but the fields tab is grey so Access won't allow me to click on anything.
This is probably an easy fix but I just don't know how to fix it.

SSIS-Slowly Changing dimension--Nvarchar(MAX) ISSUE

I am getting a data conversion error when I try to load data from one SQL table to another SQL table, using SSIS.
The source table has a column with data type nvarchar(max). The destination table has the same data type. I keep getting conversion errors when I use the Slowly Changing Dimension component.
Error: " Input column "des" (116) has a long object data type of DT_TEXT, DT_NTEXT or DT_IMAGE which is not supported"
Please help
Use something else besides the Slowly Changing Dimension. You can't use that component with nvarchar(max).

Type Conversion changes between Local PC and Server environment

I am taking some simple data from an SQL table, making a small transformation and converting it to Unicode. Then I output it into an Oracle CHAR(1 byte) field on an Oracle server.
This works without any error on my local PC. I then deploy to the server and it says that
"Column "A" cannot convert between unicode and non-unicode string data types".
After trying several things I threw my hands up in the air and just took out the data conversion to unicode and now it is broken and wont run on my PC.
BUT - it now works on the server and is all happy. I've searched and found that others have had this problem, but none seem to find the cause and just work around it it other ways.
Why can I not have my PC and my Server work the same? All tables and data connection are the SAME for both. No change other than execution location.
I got the same issue in my SSIS package and found no solution.
It was a simple data, not containing any unicode character, and it doesn't throw any exception if converting it using an SQL query or a .net code ... But it throws an exception in SSIS when using Data Conversion Transformation
Workarounds
I made a simple workaround to achieve this (you can use it if this error occurs again)
I replaced the Data Conversion Component with a Script Component
I marked the columns i want to convert as input
For each column i want to convert i created an output column of type DT_WSTR
In the Script for each column i used the following code: (assuming the input is inColumn and the output is outColumn)
If Not Row.inColumn_IsNull AndAlso _
Not String.IsNullOrEmpty(Row.inColumn) Then
Row.outColumn = Row.inColumn
Else
Row.outColumn_IsNull = True
End If
OR
If the source is an OLEDB Source you can use a casting function in the OLEDB source command
ex:
SELECT CAST([COLUMN] as NVARCHAR(255)) AS [COLUMN]
FROM ....

I'm trying to load data from oracle to SQl server in Ssis 2008 R2. In between I'm using Data conversion transformation for converting

I'm trying to load data from oracle to SQl server in Ssis 2008 R2. In between I'm using Data conversion transformation for converting an varchar2 data to DT_TEXT. Here I'm getting an error
Description: Data conversion failed while converting column "PROJECT_DESC" (1762) to column "Copy of PROJECT_DESC" (1638). The conversion returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.
the length of the particular record is around 948 and the maximum length allowed is around 2000.
Can someone please let me know what is going wrong here.
The width of the new field "Copy of PROJECT_DESC" defined in the Data Conversion is smaller than the source field "PROJECT_DESC" being read from Oracle. This is why it is warning of a truncation. Determine the length of the source varchar2 field in Oracle and then change the new field "Copy of PROJECT_DESC" to match in the Data Conversion.
Hope this helps.

Resources