473,766 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error message "String or Binary data would be trunicated", " The statement has been terminated"

Dear All,

I have written an update trigger that should write a message to an audit
table When I try to update any field in the table I recieve the following
error message -

[ODBC Sql Server Driver] [Sql Server] Stirng or Binary data would be
trunicated
[ODBC Sql Server Driver] [Sql Server] The statement has been termined.

I have looked and what has been suggested is to use the response.write len()
to check the length of field that I am updating. Being fairly new to
SQL-Server, I do not know how to do this. Any help will be most welcome.

Thanks,

Jeff
Jul 20 '05 #1
2 5258
[posted and mailed. please reply in news]

Jeff Magouirk (ma*******@njc. org) writes:
I have written an update trigger that should write a message to an audit
table When I try to update any field in the table I recieve the following
error message -

[ODBC Sql Server Driver] [Sql Server] Stirng or Binary data would be
trunicated
[ODBC Sql Server Driver] [Sql Server] The statement has been termined.

I have looked and what has been suggested is to use the response.write
len() to check the length of field that I am updating. Being fairly new
to SQL-Server, I do not know how to do this. Any help will be most
welcome.


The message means that you try to squeeze in a string into a column which
does not fit the string.

Judging from your description, the problem is in the trigger, so that is
probably the code you need to scrutinize. Response.write len() sounds
like somethnig webbish, so that is not likely to help you.

A common error is to declare a column as varchar, without specifying
any length. This results in a default of 1. In difference to client
languages, a string always has a max length in SQL. (Which has to do
with the fact that the string is to be persisted on disk.)

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
Jeff Magouirk wrote:
I have looked and what has been suggested is to use the
response.write len() to check the length of field that I am updating.
Being fairly new to SQL-Server, I do not know how to do this. Any
help will be most welcome.


Response.Write is an ASP thing, not a SQL thing. You can't reference
Response.Write within a trigger. Post your trigger and let's see what you
have. The error indicates that you are trying to put a string into a field
and the string is longer than the field is declared to be. You can suppress
the error with SET ANSI_WARNINGS OFF, but the data itself will still be
truncated to fit the field.

--
Steve Troxell
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4539
by: newbie_mw | last post by:
Seems my post was buried in more cries for help :-) I will try again. It's probably a very novice question so please take a look! Thanks! ----------------------------------------------------------------- I created a sign-up sheet (reg.html) where people fill in their first name, last name, email, etc. The data are then sent to a PHP script (reg.php). The data are then inserted into a table (reg) in MS SQL server. I have declared the...
2
2576
by: srktnc | last post by:
When I run the program, I get a Debug Error saying "This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information." I put a cout statement (//cout << "len of cPtr: " << _len << endl; ) in my constructor and see that _len is 3435973837 though my character pointer has only a few characters. Then I get the usual message as state above.
3
5587
by: NeilH | last post by:
Hello All I was wondering if someone could offer a rather inexperienced person some advice. Im trying to get my asp page to look at an access data I created the following query in access and it worked running it in access. However when i paste it into the asp page i get an "Expected end of
4
1709
by: Daedric | last post by:
Hello and thanks in advance to anyone who offers help. To make this simple, let's say I have a game which has 100 different monsters. I want a binary data file to hold all of these. It would have the index number of the mob, name, size, attributes, etc. I can easily create an editor to edit the records in this file, as soon as I know how to create this file and be able to find a specific monster in the file and fill, say, text boxes...
1
1331
by: Marc Bishop | last post by:
can anyone help me with this? Code Snippet: Dim ArrCart As New ArrayList() if NOT Session("sesCart") = "" then ArrCart = Session("sesCart") Error: System.InvalidCastException: Operator is not valid for type 'ArrayList' and string "".
9
7135
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but when I tried the program on the Win98 system it will be running on, I get the following error: Cast from string "2076719" to type 'Long' is not valid I am not sure why I only get this error on the Win98 system or how to go about correcting...
3
2751
by: nsh | last post by:
mailing.database.mysql, comp.lang.php subject: does "LOAD DATA" EVER work?!? I've tried EVERYTHING! version info: my isp is running my web page on a linux box with php ver. 4.4.1 according to phpinfo, the "mysql api client is ver. 4.0.25" - I have no idea how this relates, if at all, to the mysql engine's version. background:
10
9070
by: lovecreatesbea... | last post by:
Is it correct and safe to compare a string object with "", a pair of quotation marks quoted empty string?If the string object: s = ""; does s contain a single '\'? Is it better to use std::string::size or std::string::empty to deal with this condition? Thank you. string s = ""; if (s == ""); if (s.size == 0); if (s.empty());
7
4445
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am surrendered to you. <%@ Language=VBScript%> <%Option Explicit%>
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10009
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9838
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8835
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.