Question:

How should I write a column name in a database? between [] or a single word??

by Guest62146  |  earlier

0 LIKES UnLike

If the column name is "Abc xyz" , is it better to write it [Abc xyz] or Abcxyz ???

 Tags:

   Report

1 ANSWERS


  1. I am not sure what database you are using but in MS Sql Server, and I assume other databases, you only need to use [] around a field when either it has a space in it, or when the field name is an SQL reserved word. For example if I have a field called From and I want to query it I would have to do:

    select [From] from myTable

    I find it best to avoid using spaces in field names and reserved words whenever possible, it's just makes things easier.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.