Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Database Name

Database Name

Scheduled Pinned Locked Moved Database
databasequestion
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brendan Vogt
    wrote on last edited by
    #1

    Hi, Why can't I name a column with the name Name?   When I say "SELECT Name..." then Name appears in blue.   Why is this?   Then I use [Name].   Are then any such similar words that I need appear in blue that I need to be aware of? I have a product table, and the name of the product I called Name.   Is this incorrect?   Should I rather call it ProductName? Regards, Brendan

    L M 2 Replies Last reply
    0
    • B Brendan Vogt

      Hi, Why can't I name a column with the name Name?   When I say "SELECT Name..." then Name appears in blue.   Why is this?   Then I use [Name].   Are then any such similar words that I need appear in blue that I need to be aware of? I have a product table, and the name of the product I called Name.   Is this incorrect?   Should I rather call it ProductName? Regards, Brendan

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      .NET Enthusiast wrote:

      Name appears in blue.   Why is this?

      Those are keywords[^].

      .NET Enthusiast wrote:

      Then I use [Name]

      You can even name a column "select column", provided that you enclose it with those brackets. That would give you something like this;

      SELECT [select column] FROM [tablename]

      .NET Enthusiast wrote:

      I have a product table, and the name of the product I called Name.   Is this incorrect?   Should I rather call it ProductName?

      Both are allowed as column-names. Does a product have name, or a productname?

      I are Troll :suss:

      1 Reply Last reply
      0
      • B Brendan Vogt

        Hi, Why can't I name a column with the name Name?   When I say "SELECT Name..." then Name appears in blue.   Why is this?   Then I use [Name].   Are then any such similar words that I need appear in blue that I need to be aware of? I have a product table, and the name of the product I called Name.   Is this incorrect?   Should I rather call it ProductName? Regards, Brendan

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Check out the keyword list in Eddies post and NEVER use them. Even square bracketing them should never be allowed IMHO. Spaces in column names another horrible option that should NEVER be used. If you need to use a square bracket then there is something wrong. IIRC there used to be an app/database (I think it may have been an old ODBC driver) that refused to support [] and therefore any column requiring a [] could not be used.

        Never underestimate the power of human stupidity RAH

        B 1 Reply Last reply
        0
        • M Mycroft Holmes

          Check out the keyword list in Eddies post and NEVER use them. Even square bracketing them should never be allowed IMHO. Spaces in column names another horrible option that should NEVER be used. If you need to use a square bracket then there is something wrong. IIRC there used to be an app/database (I think it may have been an old ODBC driver) that refused to support [] and therefore any column requiring a [] could not be used.

          Never underestimate the power of human stupidity RAH

          B Offline
          B Offline
          Brendan Vogt
          wrote on last edited by
          #4

          Thanks for your reply, but I don't see Name anywhere in that list.   Description is also blue so I am assuming it is a keyword as well, but I don't see it either in that list. BTW, what does IMHO and IIRC stand for?

          M 1 Reply Last reply
          0
          • B Brendan Vogt

            Thanks for your reply, but I don't see Name anywhere in that list.   Description is also blue so I am assuming it is a keyword as well, but I don't see it either in that list. BTW, what does IMHO and IIRC stand for?

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            Not sure of the reason why name and description are highlighted blue but I only apply the rule to [], highlights do not affect the use of the word.

            .NET Enthusiast wrote:

            BTW, what does IMHO and IIRC stand for?

            Are you serious, 7 years you have been a member and not run across these contractions, this site may help[^]

            Never underestimate the power of human stupidity RAH

            B 1 Reply Last reply
            0
            • M Mycroft Holmes

              Not sure of the reason why name and description are highlighted blue but I only apply the rule to [], highlights do not affect the use of the word.

              .NET Enthusiast wrote:

              BTW, what does IMHO and IIRC stand for?

              Are you serious, 7 years you have been a member and not run across these contractions, this site may help[^]

              Never underestimate the power of human stupidity RAH

              B Offline
              B Offline
              Brendan Vogt
              wrote on last edited by
              #6

              It blue probably because they are keywords, but why isn't Name on the keywords list, if they are not there then how do I know that it is a keyword?

              L 1 Reply Last reply
              0
              • B Brendan Vogt

                It blue probably because they are keywords, but why isn't Name on the keywords list, if they are not there then how do I know that it is a keyword?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                .NET Enthusiast wrote:

                but why isn't Name on the keywords list

                Because that particular example, name isn't a standalone keyword, but rather a modifier for an existing keyword. It's used with the create database[^] command;

                CREATE DATABASE database_name
                [ ON [PRIMARY]
                [ [,...n] ]
                [, [,...n] ]
                ]
                [ LOG ON { [,...n]} ]
                [ FOR LOAD | FOR ATTACH ]

                ::=

                ( [ NAME = logical_file_name, ]
                FILENAME = 'os_file_name'
                (and more)

                SQL Server is also using these keywords as column-names, even in the master tables;

                select *
                from sysobjects
                where type = 'U'
                order by name

                Yes, it will highlight the "name" keyword, but that doesn't mean that it's an erroneous statement.

                I are Troll :suss:

                B 1 Reply Last reply
                0
                • L Lost User

                  .NET Enthusiast wrote:

                  but why isn't Name on the keywords list

                  Because that particular example, name isn't a standalone keyword, but rather a modifier for an existing keyword. It's used with the create database[^] command;

                  CREATE DATABASE database_name
                  [ ON [PRIMARY]
                  [ [,...n] ]
                  [, [,...n] ]
                  ]
                  [ LOG ON { [,...n]} ]
                  [ FOR LOAD | FOR ATTACH ]

                  ::=

                  ( [ NAME = logical_file_name, ]
                  FILENAME = 'os_file_name'
                  (and more)

                  SQL Server is also using these keywords as column-names, even in the master tables;

                  select *
                  from sysobjects
                  where type = 'U'
                  order by name

                  Yes, it will highlight the "name" keyword, but that doesn't mean that it's an erroneous statement.

                  I are Troll :suss:

                  B Offline
                  B Offline
                  Brendan Vogt
                  wrote on last edited by
                  #8

                  Thanks

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups