Besides '%', underscore '_' is also a wild card match character in MSSQL. This can lead to some very subtle bug.
Say your table name has underscore in it, e.g., there are 2 tables my_Tablename and my_WeirdTablename. You find table using 'name like %_Tablename', then you will get both tables, instead of the first one. This leads to hidden bugs that are hard to identify.
To fix this issue, use this: 'name like %[_]tablename'. The '_' char is escaped by quoting it with brackets.
Monday, October 5, 2015
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment