0
Explorer
,
/t5/coldfusion-discussions/string-or-binary-data-would-be-truncated-error/td-p/131537
Jan 14, 2009
Jan 14, 2009
Copy link to clipboard
Copied
Why am I getting this error? All I want to do is set a bit
field in my MSSQL DB to either a 0 or a 1. The arguments in my cfc
are defined as:
<cfargument name="bitCurrYearID" type="boolean" required="yes">
<cfargument name="bitNextYearID" type="boolean" required="yes">
Error I receive:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]String or binary data would be truncated.
The error occurred in C:\ColdFusion8\wwwroot\TEESO\cfc\ptacfc.cfc: line 384
Called from C:\ColdFusion8\wwwroot\TEESO\pvt\pta\eventadmin\default.cfm: line 23
Called from C:\ColdFusion8\wwwroot\TEESO\cfc\ptacfc.cfc: line 384
Called from C:\ColdFusion8\wwwroot\TEESO\pvt\pta\eventadmin\default.cfm: line 23
382 : <cfstoredproc procedure="prEventsCreateNewYear" datasource="#Application.DB#">
383 : <cfprocparam value="#Arguments.bitCurrYearID#" cfsqltype="CF_SQL_BIT" type="In" null="false">
384 : <cfprocparam value="#Arguments.bitNextYearID#" cfsqltype="CF_SQL_BIT" type="In" null="false">
385 : </cfstoredproc>
386 :
My Calling code is attached:
<cfargument name="bitCurrYearID" type="boolean" required="yes">
<cfargument name="bitNextYearID" type="boolean" required="yes">
Error I receive:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]String or binary data would be truncated.
The error occurred in C:\ColdFusion8\wwwroot\TEESO\cfc\ptacfc.cfc: line 384
Called from C:\ColdFusion8\wwwroot\TEESO\pvt\pta\eventadmin\default.cfm: line 23
Called from C:\ColdFusion8\wwwroot\TEESO\cfc\ptacfc.cfc: line 384
Called from C:\ColdFusion8\wwwroot\TEESO\pvt\pta\eventadmin\default.cfm: line 23
382 : <cfstoredproc procedure="prEventsCreateNewYear" datasource="#Application.DB#">
383 : <cfprocparam value="#Arguments.bitCurrYearID#" cfsqltype="CF_SQL_BIT" type="In" null="false">
384 : <cfprocparam value="#Arguments.bitNextYearID#" cfsqltype="CF_SQL_BIT" type="In" null="false">
385 : </cfstoredproc>
386 :
My Calling code is attached:

TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
Jan 14, 2009
Jan 14, 2009
What happens if you run the proc with those arguments via
Query Analyser
(or similar)
--
Adam
(or similar)
--
Adam
LEGEND
,
/t5/coldfusion-discussions/string-or-binary-data-would-be-truncated-error/m-p/131538#M12231
Jan 14, 2009
Jan 14, 2009
Copy link to clipboard
Copied
What happens if you run the proc with those arguments via
Query Analyser
(or similar)
--
Adam
(or similar)
--
Adam
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Kibbage-Data-Services
AUTHOR
Explorer
,
/t5/coldfusion-discussions/string-or-binary-data-would-be-truncated-error/m-p/131542#M12235
Jan 14, 2009
Jan 14, 2009
Copy link to clipboard
Copied
OK, that was the solution! I ran it from Query Analyzer and
discovered that one of the tables' fields had grown by 100
characters. When the field is copied from one table to the other
table I of course get this error!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/coldfusion-discussions/string-or-binary-data-would-be-truncated-error/m-p/131539#M12232
Jan 14, 2009
Jan 14, 2009
Copy link to clipboard
Copied
What does the stored procedure look like?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Kibbage-Data-Services
AUTHOR
Explorer
,
LATEST
/t5/coldfusion-discussions/string-or-binary-data-would-be-truncated-error/m-p/131543#M12236
Jan 14, 2009
Jan 14, 2009
Copy link to clipboard
Copied
It's a big procedure with multiple steps. However you were on
the right track. Thanks!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/string-or-binary-data-would-be-truncated-error/m-p/131540#M12233
Jan 14, 2009
Jan 14, 2009
Copy link to clipboard
Copied
CF treats Boolean variables as true/false values, whereas you
need 1/0 for the database. I typically use a CF numeric datatype as
opposed to Boolean so there is no issue. Try changing that and see
if it works.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Kibbage-Data-Services
AUTHOR
Explorer
,
/t5/coldfusion-discussions/string-or-binary-data-would-be-truncated-error/m-p/131541#M12234
Jan 14, 2009
Jan 14, 2009
Copy link to clipboard
Copied
I understand that that would be a work around but this should
work. I have several of these types of fields and it seems like a
bad design to use two bytes per field instead of a single
bit.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

