Issues with migrating from Oracle to SQL Server RRS feed

  • Question

  • We are migrating a Oracle database to SQL Server 2008

    In Oracle I got a number column for identitying boolean types, eg col name is IsInd

    In the C# code I have defined a property like

           public int IsInd{ get; set; }

    I have used SSMA tool to migrate to SQL sever 2008

    and while migrating i have mappeed Number to bit

    I am using Entity Framework,
    so after migrating when i run my code I am getting error like cannot convert bool to int since i  have defined the property with int

    since this is  a huge application i dont want any changed in the code side

    So is there any coomon fix for this , i got several many issues with this kind of casting

    I heard of a wrapper class is that fix, and how to do it?





    Monday, November 14, 2011 6:05 AM


  • If I understand you correctly, you migrated a Number for Oracle to SQL Server, using a Bit to hold the value.  However, your application is defined to view the column as an Integer.

    Of course, my first question is why did you not migrate the Oracle number into a SQL Server Integer?  If you had done so, would your EF code work just fine?  I do not work with EF personally, nor do I write C# code.

    You could create a view to cover your table that does the cast for you.  E.g.

    CREATE VIEW dbo.FixBit 
    SELECT Column1, Column2, CAST(BitColumn AS INTEGER) AS BitFlag
    FROM MyConvertedTable

    The your code needs to use the view, not the table for its reads and writes.

    Or, perhaps you can do the CAST inline from your EF code.


    PS - Since I do not program in C#, so you may be benefitted by having your post moved to another forum.

    • Edited by SQLWork Monday, November 14, 2011 7:59 PM code fix
    • Marked as answer by Phani25485 Tuesday, November 22, 2011 7:08 AM
    Monday, November 14, 2011 7:59 PM