SQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chs

    SQL


    Hi all:

    Anyone has any ideas for how to use the SQL select command to
    select the name of the columns of a table?
    I found some select command for the first row which is not
    the one
    I needed.

    cheers,
    chs





  • Aaron Bertrand - MVP

    #2
    Re: SQL

    SELECT COLUMN_NAME
    FROM INFORMATION_SCH EMA.COLUMNS
    WHERE TABLE_NAME='tab le name'




    "chs" <schhcs@pd.jari ng.my> wrote in message
    news:bf6cb3$23j $1@news5.jaring .my...[color=blue]
    >
    > Hi all:
    >
    > Anyone has any ideas for how to use the SQL select command[/color]
    to[color=blue]
    > select the name of the columns of a table?
    > I found some select command for the first row which is[/color]
    not[color=blue]
    > the one
    > I needed.
    >
    > cheers,
    > chs
    >
    >
    >
    >
    >[/color]


    Comment

    • chs

      #3
      Re: SQL


      But are there any SQL commands for Access, instead of SQL server?

      "Randy R" <rvrahbarAThotm ail.com> wrote in message
      news:ug#jLHHTDH A.2280@TK2MSFTN GP12.phx.gbl...[color=blue][color=green]
      > > Anyone has any ideas for how to use the SQL select command[/color]
      > to[color=green]
      > > select the name of the columns of a table?[/color]
      >
      > This may help you...
      > http://www.aspfaq.com/2177
      >
      >[/color]


      Comment

      • Chris Barber

        #4
        Re: SQL

        Go and read a short tutorial on 'basic' SQL and then repost any specific
        questions that you have.
        W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.


        NB: You want:

        SELECT [FieldName]
        FROM TableName

        *** OPTIONAL WHERE CLAUSE ***
        WHERE [Fieldname] = 'SomeValue'

        eg. SELECT [UserID] FROM Users WHERE [Username] = 'Gerald87'

        Would return a recordset with one field [UserID] with any records that have
        [Username] equal to 'Gerald87'.

        This sort of basic SQL statement can be used against any data source.


        "chs" <schhcs@pd.jari ng.my> wrote in message
        news:bfbp5c$18m $1@news5.jaring .my...[color=blue]
        >
        > But are there any SQL commands for Access, instead of SQL server?
        >
        > "Randy R" <rvrahbarAThotm ail.com> wrote in message
        > news:ug#jLHHTDH A.2280@TK2MSFTN GP12.phx.gbl...[color=green][color=darkred]
        > > > Anyone has any ideas for how to use the SQL select[/color][/color][/color]
        command[color=blue][color=green]
        > > to[color=darkred]
        > > > select the name of the columns of a table?[/color]
        > >
        > > This may help you...
        > > http://www.aspfaq.com/2177
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • chs

          #5
          Re: SQL

          Hi Mr. Chris Barber:
          1) Isn't my question specified enough? I am looking for SQL command to
          retrieve Access table's column name.(Please refer back to my previous post)
          2) Just simple SQL commands...not the ADOX or recordset methods posted on
          http://www.aspfaq.com/2177.
          Thanks!


          "Chris Barber" <chris@blue-canoe.co.uk.NOS PAM> wrote in message
          news:ew84fDhTDH A.2092@TK2MSFTN GP10.phx.gbl...[color=blue]
          > Go and read a short tutorial on 'basic' SQL and then repost any specific
          > questions that you have.
          > http://www.w3schools.com/sql/default.asp
          >
          > NB: You want:
          >
          > SELECT [FieldName]
          > FROM TableName
          >
          > *** OPTIONAL WHERE CLAUSE ***
          > WHERE [Fieldname] = 'SomeValue'
          >
          > eg. SELECT [UserID] FROM Users WHERE [Username] = 'Gerald87'
          >
          > Would return a recordset with one field [UserID] with any records that[/color]
          have[color=blue]
          > [Username] equal to 'Gerald87'.
          >
          > This sort of basic SQL statement can be used against any data source.[/color]



          Comment

          • chs

            #6
            Re: SQL


            Hi Mr. Chris Barber:
            1) Isn't my question specified enough? I am looking for SQL command to
            retrieve Access table's column name. (please refer back to first post)
            2) Just simple SQL commands...not the ADOX or recordset methods posted on
            http://www.aspfaq.com/2177.
            Thanks!




            "Chris Barber" <chris@blue-canoe.co.uk.NOS PAM> wrote in message
            news:ew84fDhTDH A.2092@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Go and read a short tutorial on 'basic' SQL and then repost any specific
            > questions that you have.
            > http://www.w3schools.com/sql/default.asp
            >[/color]



            Comment

            • chs

              #7
              Re: SQL



              How about just simple SQL commands...not the ADOX or recordset methods .
              Thanks!


              "Bob Barrows" <reb_01501@yaho o.com> wrote in message
              news:ueeXvphTDH A.2232@TK2MSFTN GP11.phx.gbl...[color=blue]
              > chs wrote:[color=green]
              > > But are there any SQL commands for Access, instead of SQL
              > > server?
              > >
              > > "Randy R" <rvrahbarAThotm ail.com> wrote in message
              > > news:ug#jLHHTDH A.2280@TK2MSFTN GP12.phx.gbl...[color=darkred]
              > >>> Anyone has any ideas for how to use the SQL select
              > >>> command to select the name of the columns of a table?
              > >>
              > >> This may help you...
              > >> http://www.aspfaq.com/2177[/color][/color]
              >
              > Did you read the entire article? It does describe some Access solutions.
              >
              > I would prefer to use ADOX as in the aspfaq article, but the Recordset
              > solution offered (add "Where 1=2" to the SQL statement shown to prevent[/color]
              all[color=blue]
              > the data in the table from being retrieved) should work well ...
              >
              > Bob Barrows
              >
              >[/color]


              Comment

              • Bob Barrows

                #8
                Re: SQL

                I would think you would have gotten the idea by now that there aren't any!

                Access does not maintain a table containing the column names of all the
                user-defined tables. This is one of the reasons ADOX was created.

                You might want to try the OpenSchema method as well.
                Learn with interactive lessons and technical documentation, earn professional development hours and certifications, and connect with the community.


                Bob Barrows

                chs wrote:[color=blue]
                > How about just simple SQL commands...not the ADOX or recordset
                > methods . Thanks!
                >
                >
                > "Bob Barrows" <reb_01501@yaho o.com> wrote in message
                > news:ueeXvphTDH A.2232@TK2MSFTN GP11.phx.gbl...[color=green]
                >> chs wrote:[color=darkred]
                >>> But are there any SQL commands for Access, instead of SQL
                >>> server?
                >>>
                >>> "Randy R" <rvrahbarAThotm ail.com> wrote in message
                >>> news:ug#jLHHTDH A.2280@TK2MSFTN GP12.phx.gbl...
                >>>>> Anyone has any ideas for how to use the SQL select
                >>>>> command to select the name of the columns of a table?
                >>>>
                >>>> This may help you...
                >>>> http://www.aspfaq.com/2177[/color]
                >>
                >> Did you read the entire article? It does describe some Access
                >> solutions.
                >>
                >> I would prefer to use ADOX as in the aspfaq article, but the
                >> Recordset solution offered (add "Where 1=2" to the SQL statement
                >> shown to prevent all the data in the table from being retrieved)
                >> should work well ...
                >>
                >> Bob Barrows[/color][/color]


                Comment

                Working...