Additional space inserted with column values

  • Rajesh Menon-461740

    SSC Enthusiast

    Points: 135

    I have been using .net 2 with sql compact edition 3. When I changed to windows 7 with .net 3.5

    mdf created with column values (fields) inserted with additional spalces. Eg. Field Employee code will have number 101 but with additional space so that when I search for emp code where empcode =101 it will not return any values. Can someone help

  • MyKS

    Grasshopper

    Points: 17

    It may happened due to migration. but the reason is still weird. you may go with Trim() function as a immediate solution. and try to insert new records and check still the col. gets extra spaces.

  • Jack Corbett

    SSC Guru

    Points: 184361

    If the column holds numeric data only the best way to deal with it is to use a numeric data type.

    Based on what I know the engine (even with Compact Edition although I'm not an expert) should trim any trailing spaces when doing a comparison. Are you doing the comparison with SQL or in .NET once you've loaded the data?

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply