Referencing MS SQL Table Names with spaces and dollar signs using coldfusion

Posted on 2007-08-10
Last Modified: 2013-12-24
I'm running Coldfusion MX 7 and querying SQL Server 2000.  I can query normal table names with no problem.  However, I have a large database with table names formatted as follows
My Company$Customer
My Company$Location
My question is how do I reference a table named in this manner in a SQL select statement?  I've tried it in quotes and replacing the $ with a period and nothing works.  Coldfusion gives me the following error every time: "Invalid Object Name".  There are hundreds of these tables named this way and it isn't something I can change.
Question by:KCody
    LVL 10

    Accepted Solution

    try putting brakets around it [My Company$Customer]

    Author Comment

    That was an easy fix.  Thanks.
    LVL 10

    Expert Comment

    Glad I could help ;-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Article by: kevp75
    Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now