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


    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: 184296

    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 Dont let the good be the enemy of the best. -- Paul FlemingAt best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at workCheck 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 helpNeed an Answer? Actually, No ... You Need a QuestionHow to Post Performance Problems[/url]Crosstabs and Pivots or How to turn rows into columns Part 1[/url][url url=http://www.sqlservercent

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

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