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

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
kenfhendersonAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
BrandonGalderisiConnect With a Mentor Commented:
wrap it in brackets.

select col1, col2, [badge #]
from [dbo].[Your Table can have spaces too]
0
 
kenfhendersonAuthor Commented:
Thanks super much for the quick answer!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.