Why does CR sometimes add ‘1’ to a table name?

Wednesday 31 August 2011 @ 9:10 pm

There was a recent SAP knowledge base article that I found interesting.

Whenever Crystal generates a SQL statement it always creates an alias for the table. Usually this alias is the same as each table name so some users don’t realize that an alias is being used.  Technically it is the alias, not the table name, that you see in the field lists in CR .  This way, if you add the same table to the report a second time, you will be able to tell the two instances apart. The new table’s alias will default to something like table_1 and you can change the alias to anything you want.

But sometimes I have seen that CR adds a 1 (without the underscore) to EVERY table used and never knew why.  According to this article, there are some ODBC drivers that do not allow you to have an alias that is exactly the same as the table name. Crystal checks the ODBC driver to see if the alias has to be different, and if it does then it adds the ‘1’.  This doesn’t create a problem but it does confuse some users who don’t know why their table names show differently in CR than they do in the application or in SQL Queries that do not use aliases.  It is a function of the ODBC driver.

This also sheds some light on a problem that I mentioned in a previous post with errors related to a table alias.   There must have been a difference in the ODBC driver or its configuration.









Leave a Reply

Jeff-Net
Recrystallize Pro

Crystal Reports Server