Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How do I reference a column name with an embedded space?

Posted on 2008-10-13
2
155 Views
Last Modified: 2012-08-14
I am trying to get just a few columns from a SQL Server table using:
SELECT col1, col2, col3 FROM tablename
However col3 is actually "Badge #"  (don't blame me - I didn't do the DDL!)

How do I specify the column name to transact SQL when it has an em bedded space?

Thanks!
Ken
0
Comment
Question by:kenfhenderson
2 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 500 total points
ID: 22706673
wrap it in brackets.

select col1, col2, [badge #]
from [dbo].[Your Table can have spaces too]
0
 

Author Closing Comment

by:kenfhenderson
ID: 31505685
Thanks super much for the quick answer!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delete from table 6 47
Analysis of table use 7 54
windbg taking it's time 32 93
Whats wrong in this query - Select * from tableA,tableA 11 45
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question