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. Aliasing Problem In SQL Query

Aliasing Problem In SQL Query

Scheduled Pinned Locked Moved Database
databasehelp
12 Posts 7 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.
  • L Lost User

    Hello Everybody, I have generate a problem While Aliasing Query. SQL Command is : Select S_no as S. No. From Emp;

    If you can think then I Can.

    L Offline
    L Offline
    Luc Pattyn
    wrote on last edited by
    #2

    the alias name should be a valid identifier, no punctuation, no spaces,... :)

    Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

    Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

    1 Reply Last reply
    0
    • L Lost User

      Hello Everybody, I have generate a problem While Aliasing Query. SQL Command is : Select S_no as S. No. From Emp;

      If you can think then I Can.

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #3

      Select S_no as [S. No.] From Emp;

      would work but as Luc said that its not best practice.

      As barmey as a sack of badgers Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.

      L 1 Reply Last reply
      0
      • S Simon_Whale

        Select S_no as [S. No.] From Emp;

        would work but as Luc said that its not best practice.

        As barmey as a sack of badgers Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.

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

        It's Not working..............

        If you can think then I Can.

        S M 2 Replies Last reply
        0
        • L Lost User

          It's Not working..............

          If you can think then I Can.

          S Offline
          S Offline
          Simon_Whale
          wrote on last edited by
          #5

          what sort of error message did you get?

          As barmey as a sack of badgers Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.

          L 1 Reply Last reply
          0
          • S Simon_Whale

            what sort of error message did you get?

            As barmey as a sack of badgers Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.

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

            Error is :

            Invalid bracketing on name 'S. No.'.

            If you can think then I Can.

            S 1 Reply Last reply
            0
            • L Lost User

              Error is :

              Invalid bracketing on name 'S. No.'.

              If you can think then I Can.

              S Offline
              S Offline
              Simon_Whale
              wrote on last edited by
              #7

              try

              select columnName as S_NO from tablename

              As barmey as a sack of badgers Dude, if I knew what I was doing in life, I'd be rich, retired, dating a supermodel and laughing at the rest of you from the sidelines.

              1 Reply Last reply
              0
              • L Lost User

                It's Not working..............

                If you can think then I Can.

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

                You're real problem is that you are putting UI information into the query, this type of formatting belongs in your user interface no the database Oh and this does work in sql server 2005/08

                SELECT ship [S. No.] FROM Ship AS S

                Never underestimate the power of human stupidity RAH

                1 Reply Last reply
                0
                • L Lost User

                  Hello Everybody, I have generate a problem While Aliasing Query. SQL Command is : Select S_no as S. No. From Emp;

                  If you can think then I Can.

                  W Offline
                  W Offline
                  Wendelius
                  wrote on last edited by
                  #9

                  Try adding quotation marks around the alias:

                  Select S_no AS "S. No." From Emp;

                  The need to optimize rises from a bad design.My articles[^]

                  1 Reply Last reply
                  0
                  • L Lost User

                    Hello Everybody, I have generate a problem While Aliasing Query. SQL Command is : Select S_no as S. No. From Emp;

                    If you can think then I Can.

                    V Offline
                    V Offline
                    venkynataraj
                    wrote on last edited by
                    #10

                    In SQL query '.' can be used to get a column from a table... For eg : "Select Employee.EmpId from Employee" So Sql always expects a column name after a '.' , use some other characters as alias names. This would solve your problem

                    1 Reply Last reply
                    0
                    • L Lost User

                      Hello Everybody, I have generate a problem While Aliasing Query. SQL Command is : Select S_no as S. No. From Emp;

                      If you can think then I Can.

                      P Offline
                      P Offline
                      Prasanta_Prince
                      wrote on last edited by
                      #11

                      Use a valid identifier. Dot is not a valid identifier.

                      L 1 Reply Last reply
                      0
                      • P Prasanta_Prince

                        Use a valid identifier. Dot is not a valid identifier.

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

                        read complete summery of this question. Do't waste your time in Closed Questions.

                        If you can think then I Can.

                        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