Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

spaces in database column name

Status
Not open for further replies.

kamfl610

Programmer
Apr 15, 2003
90
US
Okay, I'm relatively new at coldfusion and cfm pages. I ended up using dreamweaver to create my table but my database has field names that have spaces in them. Now when I try to retrieve them, I'm getting errors because of the spaces in the field name. Here's the snippet with the problem:

<td>#Managers.Contract Manager#</td>
<td>#Managers.Contract Manager e-mail#</td>
</tr>
</cfoutput>

Can anyone help me with how to make it retrieve that field with the spaces. I've tried lots of stuff but it's still wrong. Thanks!
 
I did find that I could use an alias but with a large database, that would be time consuming. Is there another alternative?
 
Is there another alternative?
yes, rename your fields

use double quotes or [] around your field name and give it an alias

select "Contract Manager" as "CM", "Contract Manager e-mail" as "CME"

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
er.

select "Contract Manager" as CM, "Contract Manager e-mail" as CME

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
I have done that but I am not the person who has the database. The dba set it up in SQL Server and that would be a headache to them so I guess the alias is the alternative. What a headache for me.
 
or a new line of work for your dba...

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top