Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sarahd567
Starting Member
1 Post |
Posted - 2009-03-23 : 10:14:37
|
| HiI've come across a problem with some code that has been written and saved in a stored procedure. Somehow, when this code was written, the line feed character (ASCII 10) was missed off the end of a line which had been commented out. A carriage return was entered (ASCII 13) on its own. This means that the next line of code, which appeared to be on another line, was actually read by SQL as being on the same line as the comment, and that bit of code didn't run. The problem looks like this if copied into notepad:where (left(col1,1)<>'B' -- not B and col2>99and col3<>'01/01/1900'where (left(col1,1)<>'B' -- not B and col2>99and col3<>'01/01/1900'My question is - does anyone know how this could have occured? I've tried various different combinations of keys in QA to work out how a carriage return could have been entered without a line feed, but I can't do it. Missing out the 'and col2>99' line caused significant problems (although the code ran fine so the error wasn't spotted til later) - which is why I'm keen to find out how these carriage returns got here without line feeds. Anyone have any ideas?Many thanksSarah |
|
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2009-03-26 : 12:18:17
|
| Are you trying to trace who / when the stored procedure was changed?You could use default trace which should be already running:http://www.mssqltips.com/tip.asp?tip=1111This will show when proc was last altered:select created, last_altered, routine_name FROM INFORMATION_SCHEMA.ROUTINES where routine_type ='procedure'You could restore an older copy from a backup as a testcopy to narrow down when it was done. Check who has permission to make changes. |
 |
|
|
|
|
|