Expanded select * syntax

When the source text of a stored procedure or trigger is stored in the system table syscomments a query using select * is stored in syscomments expanding the column-list referenced in the select *.

For example a select * from a table containing the columns col1 and col2 is stored as:

select <table>.col1, <table>.col2 from <table>

In 12.5.4. the expanding of the column-list is enhanced in a way that identifiers (table-names, column-names and so on) are checked if they comply with the rules for identifiers.

For example, we have a table with the columns col1 and 2col. The second column-name starts with a number which can only be done using brackets in the create table statement. These are the bracketed identifiers.

When performing a select * in a stored procedure or trigger from that table, the text in syscomments looks similar to:

select <table>.col1, <table>[2col] from <table>

For all identifiers used in the text expanding a select *, brackets are added when the identifier does not comply with the rules for identifiers.

You must add brackets around identifiers to make sure Adaptive Server can use the SQL-text while performing an upgrade to a more recent release.