You don;t need to trim these down to 16 chars as that isn't the max length you can store in a SQL 'text' field - it's something like up to 2Gb of data (on SQL2K) - even though the length says 16 on the table design (I think this was discussed in a thread here 2 or 3 weeks ago) and changing this length will make no difference. The SQL text field is like a memo field in Access.
So with the data you are inputting to MessageTitle, MessageTeaser and MessageBody you should have no problem. You've not given the field length for the 'Status' column into which you;re trying to insert 16 chars - could this be the problem ? Alex > -----Original Message----- > From: John Morgan [mailto:gameczar@;zbzoom.net] > Sent: 28 October 2002 15:14 > To: CF-Talk > Subject: Re: OT: SQL Server database problem > > > You should either trim the text being inserted using the left > function ... > > EXAMPLE: > > Left(form.MessageTeaser, 16 ) > > or you should expand the size of the field in the table. If > this is data > input via a form you could use the size option in the input > tag to enforce > the size restriction but I would still trim the data with the > left function > for safety sake. > > EXAMPLE: > > <input type="Text" name="MessageTeaser" size="16"> > > -John- > > At 02:58 PM 10/28/2002 +0000, you wrote: > >************************************************************* > ********* > >WESTMINSTER CITY COUNCIL > >Please refer to the disclaimer beneath this message > >************************************************************* > ********* > > > >Hi, > > > >I have a SQL Server 7 database and I am trying to insert a > large amount of > >text, passed by a ColdFusion form, into a table within this database. > > > >The problem I am having is a "ODBC Error Code = 22001 > (String data right > >truncation)" error. > >My table design is like this. > > Column name Datatype Length > > MessageID int 4 > > MessageType char 20 > > Department char 20 > > CreationDate char 15 > > PublicationDate char 15 > > MessageTitle text 16 > > MessageTeaser text 16 > > MessageBody text 16 > >I think that the problem is when the text is being added to > the fields, > >MessageTitle, MessageTeaser and MessageBody. > >This is the complete error message: > > > >ODBC Error Code = 22001 (String data right truncation) > >[Microsoft][ODBC SQL Server Driver][SQL Server]String or > binary data would > >be truncated. > >SQL = "INSERT INTO Messages ( MessageType, Department, CreationDate, > >PublicationDate, MessageTitle, MessageTeaser, MessageBody, > Status ) VALUES ( > >'None', 'Housing', '28/10/2002', 'Awaiting', 'Some text to > throw error', > >'Some text to throw error, Some text to throw error', 'Some > text to throw > >error,Some text to throw error and Some text to throw > error', 'Awating > >Approval' )" > >Data Source = "WIRE_USERS" > >The error occurred while processing an element with a > general identifier of > >(CFQUERY), occupying document position (24:1) to (24:57) in > the template > >file E:\INETPUB\WWWROOT\WIRE\MESSAGES\SENDFORAPPROVAL.CFM. > >Anyone know how I can fix this error? > >Thanks > >Stephen > > > > > > > >************************************************************* > ********* > >Westminster City Council switchboard: > >+44 20 7641 6000 > >************************************************************* > ********* > >This E-Mail may contain information which is > >privileged, confidential and protected from > >disclosure. If you are not the intended recipient > >of this E-mail or any part of it, please telephone > >Westminster City Council immediately on receipt. > >You should not disclose the contents to any other > >person or take copies. > >************************************************************* > ********* > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.