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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Column names with embedded spaces

Status
Not open for further replies.

Koonpl

Programmer
Jul 24, 2000
2
0
0
US
Hi all,<br><br>I was wondering if anyone knows of a way to use an Access data table with embedded spaces in the field names.&nbsp;&nbsp;<br><br>I have a database that is delivered to me and it has embedded spaces in the field names.&nbsp;&nbsp;I asked the owner of the data if they would remove the spaces.&nbsp;&nbsp;However, they were unwilling to do this.&nbsp;&nbsp;So ... I am now seeking a method to use the data as is.&nbsp;&nbsp;I have been able to get coldfusion to send the sql statement successfully.&nbsp;&nbsp;But, I do not know how to output the data. e.g.,<br><br>&lt;CFQUERY name=&quot;SomeQuery&quot; datasource=&quot;alldata&quot;&gt;<br>select [field name with embedded spaces].mydata<br>from mydata<br>&lt;/CFquery&gt;<br><br>&lt;CFoutput query = &quot;SomeQuery&quot;&gt;<br>#[field name with embedded spaces]#<br>&lt;/CFoutput&gt;<br><br>Does not work!<br><br>Any advice will be appreciated!<br><br>Phillip Koon
 
try aliasing the fieldnames that contain spaces like:<br><br><FONT FACE=monospace>&lt;CFQUERY name=&quot;SomeQuery&quot; datasource=&quot;alldata&quot;&gt;<br>select [field name with embedded spaces].mydata AS FieldWithoutSpaces<br>from mydata<br>&lt;/CFquery&gt;</font><br><br>Then reference the alias in CFOUTPUT:<br><br><FONT FACE=monospace>&lt;CFoutput query = &quot;SomeQuery&quot;&gt;<br>#FieldWithoutSpaces#<br>&lt;/CFoutput&gt;</font><br><br>That should work. Hope this helps,<br><br>Bromrrrr<br><br><br><br><br>
 
Thanks Bromrrr, it worked great!<br><br>Phillip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top