Google

Sunday, November 4, 2007

Why to use bracket '[' around table name and column name?

The error : Incorrect syntax near the keyword tablename(before the space) will appear if tried to use a tablename with space in between. We can use square bracket '[' around table name or column name, for generally specifying a table name with spaces. For e.g. Select * from my table ---> this statement will not work as tablename 'my table' has a space. Either you can write , Select * from 'my table' OR Select * from [my table] When sometimes we have defined Schema names for database and they contain some '.' , then we can write Select * from [s.ssd].[my table] For using a particular database, dont forget to type use databaseName Go then your statement

1 comment:

Anonymous said...

Thank you so much!
how generous of you to share this information. This has solved all of my problems!

Thanks again,
Gemma