Brackets in name causes difference
StevenD
Posts: 3
Hi,
I'm currently testing SqlCompare v4. I've noticed Sql Compare lists some tables as different although the only difference is that their names are enclosed in brackets on one db and not on the other. (eg. [dbo].[MyTable] vs dbo.MyTable). Note that this only occurs for a few tables (4 out of 50 or so). I've looked for an option to ignore brackets, but I haven't found anything. Is there a solution for this?
thanx
I'm currently testing SqlCompare v4. I've noticed Sql Compare lists some tables as different although the only difference is that their names are enclosed in brackets on one db and not on the other. (eg. [dbo].[MyTable] vs dbo.MyTable). Note that this only occurs for a few tables (4 out of 50 or so). I've looked for an option to ignore brackets, but I haven't found anything. Is there a solution for this?
thanx
Comments
There isn't a way to ignore the identifiers of SQL objects. I haven't seen this behaviour before -- which database platform is this? SQL 2005?
After experimenting some more, I found out that whether the problem occurs or not, depends on how the tables (or in my case it were views) are made. If you make a table from within SQL server Management Studio, the square brackets are *not* added. So if I make a view called TEST, Sql Compare will treat it as:
CREATE VIEW TEST
AS
...
If you generate a create script from within SqlServer Mgmt Studio, it will add the brackets (and the schema):
CREATE VIEW [dbo].[TEST]
AS
...
If then use this script to update the 2nd database and compare the two databases, Sql Compare will report them as different. So it seems as if Sql Compare uses the exact string that is used to create the database...
Hope this helps,
Steven
I had a suspicion that was it. There are many posts about this very same topic in the forum already. It appears that the problem is too complicated to fix anytime soon. SQL 2005 is adding these identifiers automatically.