Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 239725 - Last Review: December 5, 2003 - Revision: 4.1
BUG: SQL Server Error "Specified Column Precision 38 Is Greater Than the Maximum Precision of 28. (2750)" When Running Parameterized Query
This article was previously published under Q239725
BUG #: 55723 (SQLBUG_70)
When you run a parameterized query, with a parameter of type decimal and a
precision of 38, against a SQL Server 7.0 database using the 3.70 driver,
you may receive the following error message:
Server: Msg 2750, Level 16, State 1, Procedure #odbc#efwadm19151b, Line 0
Column or parameter #2: Specified column precision 38 is greater than the maximum precision of 28.
Parameter '@P2' has an invalid data type.
The SQL ODBC driver uses a default value of 38 for the precision value if the application specifies
SQL_DEFAULT for the precision when binding a decimal parameter. However, the default decimal precision on the SQL Server is 28.
To work around this problem, start SQL Server with a
-p38 parameter to set the default server precision to 38.
Microsoft has confirmed this to be a problem in SQL Server 7.0.
Steps to Reproduce Problem
- Cut and paste the following code into SQL Query Analyzer:
CREATE TABLE [dbo].[abcd] (
[a] [int] NULL ,
[b] [datetime] NULL ,
[c] [decimal](18, 5) NULL ,
[d] [int] NULL
) ON [PRIMARY]
GO
- Attempt to execute the following:
create proc #odbc#efwadm19151b(@P1 int,@P2 decimal(38,5),@P3 int) as INSERT INTO abcd( a, b, c, d) VALUES (@P1, getdate() ,@P2,@P3)
APPLIES TO
- Microsoft SQL Server 7.0 Standard Edition
- Microsoft ODBC Driver for Microsoft SQL Server 3.7
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate