Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: SQL Server Error "Specified Column Precision 38 Is Greater Than the Maximum Precision of 28. (2750)" When Running Parameterized Query


View products that this article applies to.

Symptoms

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.

↑ Back to the top


Cause

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.

↑ Back to the top


Workaround

To work around this problem, start SQL Server with a -p38 parameter to set the default server precision to 38.

↑ Back to the top


Status

Microsoft has confirmed this to be a problem in SQL Server 7.0.

↑ Back to the top


More information

Steps to Reproduce Problem

  1. 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
    					
  2. 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)
    					

↑ Back to the top


Keywords: KB239725, kbpending, kbbug

↑ Back to the top

Article Info
Article ID : 239725
Revision : 5
Created on : 12/5/2003
Published on : 12/5/2003
Exists online : False
Views : 351