datype in sql server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siri11
    New Member
    • Sep 2007
    • 38

    datype in sql server

    Hi...
    can anyone plzz suggest me as to how to assign a datatype in sql server for a column(field) which should accept decimal,double or float data as per the result which is obtained in front end.The problem is I have given the "Float" datatype to this field.And for ex: If the result is 12.56 then it is storing the value as 12.560000419616 7 in the Database.

    And again when I display this value,it is showing this long number on screen which looks very incorrect.

    And if I give the datatype as Numeric(15,5) for the column(field) in sql server,so that after decimal point it can store 5 digits, another problem is arising that is.If for ex:If I enter 12.56 then it is storing the value as 12.56000 in the database.

    Which datatype should I choose so that it stores the exact value (i.e whatever I enter) into database without any changes.
    Plzzzzzzzz help..

    siri
  • CyberSoftHari
    Recognized Expert Contributor
    • Sep 2007
    • 488

    #2
    You should not bother about data(display format) in the database, you can format it from front-end. Can you post your front-end and its version details?

    Comment

    • siri11
      New Member
      • Sep 2007
      • 38

      #3
      hi,, My application front end is (.Net) MS Visual Studio 2005. Version 2.0 Plzz suggest how to format Thnks in advance siri

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by siri11
        hi,, My application front end is (.Net) MS Visual Studio 2005. Version 2.0 Plzz suggest how to format Thnks in advance siri
        Which .NET language are you using?
        You can use the String.Format method.
        I'll now move this to the .NET forum

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Originally posted by siri11
          hi,, My application front end is (.Net) MS Visual Studio 2005. Version 2.0 Plzz suggest how to format Thnks in advance siri
          That depends on what mode you are using to display your data. A grid view column will have a property called "DataFormatStri ng" which works on the same principles as String.Format() . This article should help.

          Comment

          Working...