Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7437865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:27:53+00:00 2026-05-29T10:27:53+00:00

I have SQL Server 2008 Express Edition installed and is my first time running

  • 0

I have SQL Server 2008 Express Edition installed and is my first time running a SQL query. I noticed that if I select to display the top 1000 rows that the query places brackets [] around the name of the database and its respective columns.

  1. Why are there brackets around the name of the database and columns?
  2. Is there a need to have these and if so when?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:27:54+00:00Added an answer on May 29, 2026 at 10:27 am

    I just posted this answer on dba.stack.

    They escape names that are not “friendly” – they can be useful if your database names contain special characters (such as spaces, dots or dashes) or represent SQL keywords (such as USE or DATABASE :-)). Without the square brackets, a query like this will fail:

    SELECT column FROM database.dbo.table;
    

    However if you write the query this way, the keywords are ignored:

    SELECT [column] FROM [database].dbo.[table];
    

    When building scripts or writing solutions that generate scripts from metadata (e.g. generating a script of all tables or all indexes), I always wrap entity names in square brackets so that they will work regardless of what kind of wonky names have been implemented (I am not always doing this for systems I control). You can do this easily using QUOTENAME function, e.g.:

    SELECT QUOTENAME('table'), QUOTENAME('column'), QUOTENAME('database');
    

    Results:

    [table] [column] [database]
    

    If you search my answers here for QUOTENAME you will find that I use it in a lot of scripts where I’m helping folks automate script generation or building dynamic SQL. Without the square brackets, a lot of people would run into issues running the scripts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed SQL Server 2008 Express Edition, but by mistake I kept the
I have a database table (SQL Server 2008 R2 Express edition) that has a
I am looking for SQL Server Profiler in SQL Server 2008 express edition.I have
I have installed SQL Server 2008 express and logging in through windows authentication, it
I have sql server 2008 R2 Express installed, but it seems the full text
I had installed sql server 2008 express edition with tools but I need to
I am using SQL Server 2008 express edition. I have connected before. Now I
I have SQL Server 2008 R2 Express with advanced services installed on my computer.
I have 3 instances running of SQL Server 2008 R2 Express, to try and
anyone have script or procedures to install SQL Server 2008 Express, set up the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.