You can include any characters—even blanks—in a column heading if you enclose the entire heading in quotation marks. You do not need to set the quoted_identifier option on. If the column heading is not enclosed in quotation marks, it must conform to the rules for identifiers. Both of the following queries produce the same result:
select "Publisher’s Name" = pub_name from publishers
select pub_name "Publisher’s Name" from publishers
Publisher’s Name ---------------- New Age Books Binnet & Hardley Algodata Infosystems (3 rows affected)
You can also use Transact-SQL reserved words in quoted column headings. For example, the following query, using the reserved word sum as a column heading, is valid:
select "sum" = sum(total_sales) from titles
Quoted column headings cannot be more than 255 bytes long.
Before using quotes around a column name in a create table, alter table, select into, or create view statement, you must set quoted_identifier on.
Copyright © 2005. Sybase Inc. All rights reserved. |