Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Additional space inserted with column values Expand / Collapse
Author
Message
Posted Thursday, November 17, 2011 4:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, February 10, 2014 1:09 AM
Points: 5, Visits: 56
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
Post #1207383
Posted Monday, January 9, 2012 2:55 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 18, 2013 6:17 AM
Points: 3, Visits: 27
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.
Post #1232277
Posted Monday, January 9, 2012 2:28 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 9:09 AM
Points: 10,342, Visits: 13,352
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

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

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
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1232812
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse