Identifier case issue

Discussion of open issues, suggestions and bugs regarding database management and development tools for SQL Server
Post Reply
sebeto
Posts: 9
Joined: Tue 22 Apr 2014 03:19

Identifier case issue

Post by sebeto » Mon 29 Dec 2014 02:27

Hi,

I use SQL Complete on case sensitive databases. As the column aliases become column titles in our software interface, I have to deal daily with queries such as:

Code: Select all

select sc.NAME as [Name]
	,sc.[DESCRIPTION] as [Description]
	,sc.DATATYPE as [Data Type]
	,sc.SCUNITS as [Units]
from SAMPLECODE as sc
order by sc.NAME
The problem is that when I run code formatting on this with the identifier case set to "As in the database", it becomes:

Code: Select all

select sc.Name as [Name]
	,sc.[Description] as [Description]
	,sc.DATATYPE as [Data Type]
	,sc.SCUNITS as [Units]
from SAMPLECODE as sc
order by sc.Name
The query then fails as it should be sc.NAME. Even without the aliasing of columns, SQL Complete gets confused if another table in the database has the same column name in a different case. You can view the issue with this kind of query:

Code: Select all

select sc.NAME
	,sc.[DESCRIPTION]
	,sc.DATATYPE
	,sc.SCUNITS
from SAMPLECODE as sc
	join (
	values ('A name')
	) as vals (name)
	on vals.name = sc.NAME
order by sc.NAME
which gets formatted as:

Code: Select all

select sc.name
	,sc.[DESCRIPTION]
	,sc.DATATYPE
	,sc.SCUNITS
from SAMPLECODE as sc
	join (
	values ('A name')
	) as vals (name)
		on vals.name = sc.name
order by sc.name
It has become quite an issue lately as I need to run queries on databases with different cases for the column names, so I can't use SQL formatting on these queries. Am I doing something wrong?

My setup is as follows, "Identifier Case" is set to "As in the database":
Image

alexa

Re: Identifier case issue

Post by alexa » Tue 30 Dec 2014 11:06

We will fix this issue in one of the next product builds and will notify you once it's available for downloading.

sebeto
Posts: 9
Joined: Tue 22 Apr 2014 03:19

Re: Identifier case issue

Post by sebeto » Wed 31 Dec 2014 02:02

Thank you Alexa, and have a very happy new year!

alexa

Re: Identifier case issue

Post by alexa » Wed 31 Dec 2014 13:56

A Happy New Year to you too! Please let us know if any questions arise.

alexa

Re: Identifier case issue

Post by alexa » Tue 17 Feb 2015 13:18

After taking a closer look into this issue, it follows that dbForge searches the original definition by the first match of the name. We recommend you to use the aliases differring from the column names.

In fact, we could change such a behavior and make dbForge to search first in a database and only then in a script, however, it will cause the alternative scenario when aliases will be switching to the column case.

Post Reply