September 30, 2014 at 7:01 am
I am having an issue where white space is consistently being added to fields in a SQL DB (2008). All of the offending fields are VARCHAR fields with specified lengths. We run LTRIM/RTRIM statements against the tables, and the issue resolves, but a few days later, the issue crops up again. Same tables/fields. I am wondering what could be causing this issue. Would regular maintenance routines assist with this issue? Could creating a backup cause this issue? I am completely baffled. (DB is back-end to a c# web application). We have other DB's that are exactly the same, where this issue does not occur, so I am looking for any suggestions on how we can prevent this from happening. I have tried google, and no luck. Any assistance would be greatly appreciated. Thanks in advance!
September 30, 2014 at 7:04 am
jlandry (9/30/2014)
Would regular maintenance routines assist with this issue?
No
Could creating a backup cause this issue?
No.
so I am looking for any suggestions on how we can prevent this from happening.
Something is running update statements against those tables. Either audit with triggers, run a server side trace or configure extended events and see who and what is running those updates.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 21, 2014 at 3:12 pm
Just curious, could affected tables with the working database and the database that gets spaces have different ANSI_PADDING settings?
October 21, 2014 at 5:37 pm
After "googling", I check that... :-/ The ANSI padding wasn't set. Still looking around. The DBA also ensured me that there are not any maintenance routines that "update" the tables.
October 21, 2014 at 6:38 pm
Something has to be running an update somewhere. Are the other databases identical including the stored procedures and front-end code?
Is there something that runs does update to the result of a cast to a CHAR?
If you can't find it, Gail already suggested the trigger and trace.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply