sougatamondal / migratordotnet

Automatically exported from code.google.com/p/migratordotnet
0 stars 0 forks source link

TableExists fails to detect that table exists if table name is a reserved keyword #100

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a table with table name [File]
2.
3.

SqlServerTransformationProvider.TableExists should return true when the
table exists. It actually returns false.

version 0.8.0 .NET 3.5 SQL2005

In version 0.8.0 the query used to check if a table exists changed. In
version 0.7.0 the query was:

SELECT TOP 1 * FROM syscolumns WHERE id=object_id('[File]')

which returns a table regardless of the []. In version 0.8.0:

SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='[File]'

does not return the table.

Any tables that share a name with a reserved keyword have to be wrapped
with [] to pass validation earlier up in the call stack. However, this sql
statment requires the table name without [] be used.

Original issue reported on code.google.com by phi...@gmail.com on 13 Mar 2009 at 4:20