.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

statement with SQL_C_WCHAR returns 22001 string data, right truncation error

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :Sql Server
I am trying to execute the following code  value = L"Test13Digit++"; SQLPrepare(stmt, L"delete Entries where [type] = ?", SQL_NTS); SQLBindParameter(stmt, paramNumber, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 100, 0, (SQLPOINTER) value.c_str(), 0, &strLen); SQLExecute(stmt); the table entries is as follows: Entries ([type] nvarchar(100), [key] nvarchar(100), [version] bigint, [data] varbinary(8000), CONSTRAINT PK_Entries PRIMARY KEY([type], [key]))   I keep getting the 22001 - string data, right truncation error. I have tried all different versions of WCHAR types but does not seem to help.

View Complete Post

More Related Resource Links

Error Message: String or binary data would be truncated. The statement has been terminated




I have the following problem.

When I edit a field in the SQL Server Management Studio Express then I get the following error:

Error Source: .Net SqlClient Data Provider
Error Message: String or binary data would be truncated.

The statement has been terminated


When I use the SQL update commando, it works fine.

Fore debugging we need to change the enabled field several times.

Is there a solution fore this?



The Table Layout

USE [Project]


/****** Object: Table [dbo].[Proces] Script Date: 06/02/2008 10:01:20 ******/

ex {"String or binary data would be truncated. The statement has been terminated."}

Hello all,Please I have a Contact form which a user can use to send his or her message to the admin of a website. When all is done, he or she must click on submit button which in turn runs the code below.However, when this done the is an error ex    {"String or binary data would be truncated. The statement has been terminated."}. I would be grateful if someone could help me out to prevent the error.Thank you. Protected Sub txtSendMessage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSendMessage.Click Dim hdDataSource As New SqlDataSource() hdDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("hotelpauldbConnectionString1").ToString() hdDataSource.InsertCommandType = SqlDataSourceCommandType.Text hdDataSource.InsertCommand = "INSERT INTO contact (emailaddress, name, phone, reason, message) VALUES (@emailaddress, @name, @phone, @reason, @message)" hdDataSource.InsertParameters.Add("emailaddress", txtEmail.Text) hdDataSource.InsertParameters.Add("name", txtName.Text) hdDataSource.InsertParameters.Add("phone", txtPhone.Text) hdDataSource.InsertParameters.Add("reason", cmbReason.SelectedItem.Text) hdDataSource.InsertParameters.Add("message", txtMessage.Text) Dim

Error 8132:String or Binary data would be truncated. - Error only occurs when running execution of S

I have a Stored Procedure that I can execute from SQL Mgmt>New Query and running the exec statement and all is well. However, I have the same statement in a automated SQL Agent Job that the first step creates the Stored Procedure, second step executes Stored Procedure and then various other steps afterward. However, the job worked fine for a while and now the job dies at the second step each time. If I copy and paste the command for the second job in a new query manually, it works fine and the rest of the steps can process. Is this a bug?

extract picture data from a string


dears,advance thanks.can anybdy help to solve my problem which is describing below.

Example- %%D1,100,0,0004[data...][0d0a]

Head - %%D1
Amount of data package -100
The data package No. - 0
Data Length -1024 (0004 (low bit in front, high bit in back) 0004= 0x0400=1024;)

data- Original Picture data -1024(maximum)
Tail -0x0d0a
Data in hex

from the above example i want to extract picture data and need to store in to the sql table.sql table columname is image and datatype is also image.after that i wanted to display this image column to an aspx page.

expecting help asap.

datarow data insertion error


this is the code which i am using and what i want means when i==0 first record should bind to datatable and when i==1 2nd record should bind to datatable. that means when i==1 1st and 2nd record should be present in datatable  Please see the code below


when i am binding 2nd record to datatable 1st record is getting deleted and recently inserted value is getting inserted please tell me how to resolvie this


datatable dt11=new datatable();
DataRow row11=null;

if (i == 0)
row11 = dt11.NewRow();

row11["qid"] = qnumber;

row11["question"] = question;
row11["useranswer"] = correctans;
row11["flag"] = answerstatus;


if (i == 1)

qnumber =ds5.Tables[0].Rows[i][0].ToString();
question =ds5.Tables[0].Rows[i][1].ToString();

row11 = dt11.NewRow();

Data Truncation issue with Enterprise Library Logging WriteLog stored Proc


Hi ,

I'm using Enterprise Library Logging  feature for logging. The issue i am facing is when the Logging message is too large(more than 65534 chars) ,complete data  is not logged in the Formatted Mesage column which is  of data Type nText .

I am able insert complete data if i try inserting from Sql insert Query from sql management studio. Do i need to add any attributes to data base listener or do i need to change the sp.

 Is there any way to increase the WriteLog stored proc param size in EnterpriseLibrary.Logging config file ? . Please let me know.


Thanks In Advance.

show data in grid view error Arithmetic operation resulted in an overflow.



i have a table there is 17 columns in 17 column 3 are number and other are varchar . when i try to display all data of that column error occures.

one more intersting think is when i try to display 6 column then grid show there data an no more error occures. 

when i run my project this error occures in grid view

Arithmetic operation resulted in an overflow. 

override error message (The value 'test' is not valid for Age) when input incorrect data type for in


Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

public class Person
public string FirstName {get;set;}
public int Age {get;set;}


For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.

Error converting data type varchar to numeric.


I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


Business Data Error: System.OverFlowException


I have a Business Data Catalog file I've uploaded to connect to our back end Firebird DBMS through ODBC.

The SharePoint server is MOSS 2007 x64. The web front end server(s) all have an x64 Firebird Engine and ODBC driver with verified connectivity to Firebird.

When I use one of the methods, I can see connections being made to our Firebird server and the query being passed. I know the query returns results (it's a stored procedure with no parameters), but I get the following error "An error occurred while retrieving data from MROTest1. Administrators, see the server log for more information" in IE. If I look in the server logs, I see (12\Hive\Logs)

Exception handed to HandleRuntimeException.HandleException System.OverflowException: Arithmetic operation resulted in an overflow.     at System.Data.Odbc.OdbcDataReader.GetData(Int32 i, SQL_C sqlctype, Int32 cb, Int32& cbActualOut)

"An error occurred while retrieving data from Oracle Instance..."


I have succeffuly Imported the ADF and have also successfully created a Business Data Column. But when I try to query data , I get the following error

An error occurred while retrieving data from Oracle Instance. Administrator, see the server log for more information

And this is what I found in the Application Logs
A Metadata Exception was constructed in App Domain '/LM/W3SVC/81256521/ROOT-1-129217212004078822'. The full exception text is: LobSystem could not be found using criteria 'id=476'.

Resume SharePoint Services Web Application and returns code 1387 error


Hello everyone! Newbie here. I would like to ask how to start the SharePoint Services Web Application on (WSS3.0,internal database, stanalone users) without getting error 1387 ?

I would love to provide more information regarding this issue but what I got is error 1387 displayed in the browser.

I look forward to seeing you guys feedback from your expertise angle.



Data list error with using tabs


I need ure help,

my question is that I need to show a tab two times in my web page ,,, each time this tab will be showed it will have different data will be called from a database while the page loaded >>>> when I use my code I can show the tab one time only

I will insert my code here look at it and tell me where the error


<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc2" %>

<td align=left >   
  •     &l
  • SQL statement to get data like outlook


     I have been struggling to write an sql statement that will give me data like outlook format., especially in term of grouping like





    Last week

    two weeks ago

    Last Month


    Is there anyone that can help me on this please? I appreciated

    Reading xml data from xml string




    i have string like below:

    <?xml version="1.0" encoding="utf-8" ?>










    VS2005 calling VS2010 asmx service returns empty string


    Anyone have any experience with this?

    We are using VS 2005 for the front end, and vs 2010 for the web services part (asmx), not wcf yet.


    Web service works just like the vs2005 when run locally, no problems.


    Connecting to it from a test app returns an empty string. Connecting to a 2005 app doesn't!

    Anyone run into this before or have a suggestion? Surely vs 2005 can connect to web services from a later version?






    Looking for TSQL statement that returns customers with greatest number of order in descending order

    What would be an efficient TSQL SELECT statement that joins customer and order tables, counts the orders for each customer (group by) and returns a result for all customers with at least one order, and also in descending order from customers with the most orders to the least?
    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend