Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8091083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:56:45+00:00 2026-06-05T19:56:45+00:00

Why is SQL integral numeric column (for example NUMERIC(3,0) ) generated in C# (in

  • 0

Why is SQL integral numeric column (for example NUMERIC(3,0)) generated in C# (in DataSet
as column type or in DataAdapter as parameter type) as type Decimal?

NUMERIC(3,0) can store integral values in range of -999 to 999. I think it should be in C# generated as type int or another integral one.

I think, this behavior is .NET or Visual Studio serious bug. How should I solve it, if I don’t want rewrite generated code and I don’t want to convert everywhere I use it between int and decimal? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:56:48+00:00Added an answer on June 5, 2026 at 7:56 pm

    Your question is why MSSQL NUMERIC is converted to C# Decimal and the answer is because NUMERIC is still a floating point value even though you specify that it has no decimal places like NUMERIC[3,0].

    It would not make sense if NUMERIC where converted into C# into different types depending on whether or not you indicated it has any decimal points or not.

    I assume you are using NUMERIC[3,0] to save space in the database, but according to the docs, it uses 5 bytes. A SQL INT, on the other hand, only uses 4. And, even better, a SMALLINT uses only 2 bytes.

    Unfortunately, you’re either going to have to convert your database to use SMALLINTs instead of NUMERIC or you’re going to have to convert in your C#.

    It would be nice if you had only one entity that retrieved data from your database and then you could keep your conversions to a minimum and localized to a single location.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SQL Server 7.0 VB 6.0 Crystal Report 8 Column Name: myColumn Data Type: numeric
SQL - how to get the min/max values of a column in a table
SQL statement: INSERT INTO order (`ORDER_ID`,`SALE_CODE`,`CREATED_AT`,`UPDATED_AT`) VALUES ('2646253286','HPHS20','2009-07-11 12:07:40','2009-07-11 12:07:40') Error: You have an
SQL Server provides the type [rowguid]. I like to use this as unique primary
SQL 2005, I have a table with a column 'ages_c', I need to group
SQL Server Reporting Services (SSRS) 2008 R2 I've set up a shared dataset that
SQL Server 2008 Profiler always profiles all databases. I want to restrict profiling or
SQL Server doesn't support the SELECT FOR UPDATE syntax, which is used by NHibernate
SQL Server a stored procedure written in C# on the .NET 2.0 framework that
SQL Server 2005 Profiler shows that a Stored Procedure (SP) was called and what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.