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

  • Home
  • SEARCH
  • 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 3664400
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:38:31+00:00 2026-05-19T01:38:31+00:00

We have two stored procedures in Microsoft SQL Server that return data that is

  • 0

We have two stored procedures in Microsoft SQL Server that return data that is conceptually of the same type. One returns an ID as SCOPE_TDENTITY() (a numeric), while the other returns 0 (an int32). We have a complex type with a property ID. If this property is a nullable decimal, we receive the following error when enumerating the results of the sproc that returns an int32:

The 'ID' property on 'EntitryRequestReturn' could not be set to a 'Int32' value. You must set this property to a non-null value of type 'Decimal'.

Changing the type of the property to an int32 just moves the error to the other sproc, with the data types listed in the opposite order. Changing whether the types are nullable doesn’t make any difference.

How can I get EF4 to convert an int column returned from a sproc into a decimal when constructing the complex type?

  • 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-05-19T01:38:31+00:00Added an answer on May 19, 2026 at 1:38 am

    This worked in my instance. It may help here.

    If the stored procedure returns data via a select statement, it helps greatly to cast all the return fields, even if they are in their native data types.

    select convert(int, myInt) as myInt
    

    works better than

    select myInt
    

    A lot of times my SPs would show a string as the last field when it was really an Int32. I added convert statements to all the fields and it never made that mistake again.

    That said, you could simply do the conversion in the SP before it’s sent to EF.

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

Sidebar

Related Questions

I have two Microsoft SQL Server 2000 databases, and a stored procedure on one
I have a stored procedure that returns two int Values. The first can not
I have an SQL (Microsoft SQL 2008) table with XML data in one of
I have a table containing two columns in SQL that I want to extract
I have two related classes which share a common interface and are both stored
I have two tables, one stores the products and quantity we have bought, the
I have two models: Person and Relation. The second one stores information about relations
I have two applications written in Java that communicate with each other using XML
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two classes, and want to include a static instance of one class

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.