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. Alter Query

Alter Query

Scheduled Pinned Locked Moved Database
databasetutorialquestion
6 Posts 4 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.
  • I Offline
    I Offline
    ivo75
    wrote on last edited by
    #1

    Hi I use this

    ALTER TABLE table_name
    ADD column_name datatype

    to add column in table. How to use Alter Query to add column in query? I use MS Access 2003.

    J G 2 Replies Last reply
    0
    • I ivo75

      Hi I use this

      ALTER TABLE table_name
      ADD column_name datatype

      to add column in table. How to use Alter Query to add column in query? I use MS Access 2003.

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      You can't add it. Depends on what you mean by 'query'. In terms of procs you must replace the proc either by using 'replace' or 'drop' and 'create'. Which one depends on the database. If the query is other code then the code must be updated.

      I 1 Reply Last reply
      0
      • J jschell

        You can't add it. Depends on what you mean by 'query'. In terms of procs you must replace the proc either by using 'replace' or 'drop' and 'create'. Which one depends on the database. If the query is other code then the code must be updated.

        I Offline
        I Offline
        ivo75
        wrote on last edited by
        #3

        for example I have 1 query in who participate 3 columns in 2 table and I want to add 1 column in first table and column in query will be 4. I want do this with code.

        S J 2 Replies Last reply
        0
        • I ivo75

          for example I have 1 query in who participate 3 columns in 2 table and I want to add 1 column in first table and column in query will be 4. I want do this with code.

          S Offline
          S Offline
          S Douglas
          wrote on last edited by
          #4

          ivo75 wrote:

          I want to add 1 column in first table and column in query will be 4.

          As jschell indicated, you will need to use an alter statement to replace the existing view with a new one. Here is a site that has more detail about how you alter a veiw in Access (I didn't think it was posible, but then I havent worked with MS Access since 1997) http://allenbrowne.com/func-DDL.html[^]


          Common sense is admitting there is cause and effect and that you can exert some control over what you understand.

          1 Reply Last reply
          0
          • I ivo75

            for example I have 1 query in who participate 3 columns in 2 table and I want to add 1 column in first table and column in query will be 4. I want do this with code.

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            ivo75 wrote:

            for example I have 1 query in who participate 3 columns in 2 table and I want to add 1 column in first table and column in query will be 4. I want do this with code.

            Not sure I understand what you are saying. However you appear to be referring to that you now have the following: select t.a, t.b, t.c from... And you want the following: select t.a, t.b, t.c, t.d from... The problem with that is that SOMETHING is using the first query. And it is not going to magically use the second one. At best (depending on a number of things) it will simply do nothing at all. At worse something will fail in a way that makes it difficult to determine what happened. So the best case has no impact - so no point in trying to change it. In the worst case many things fail - so not point in trying to change it. Thus it follows, what you think that you want to do will NOT work.

            1 Reply Last reply
            0
            • I ivo75

              Hi I use this

              ALTER TABLE table_name
              ADD column_name datatype

              to add column in table. How to use Alter Query to add column in query? I use MS Access 2003.

              G Offline
              G Offline
              Ganu Sharma
              wrote on last edited by
              #6

              alter exists column datatype. alter table tblname alter column columnname datatype(variablesize) or add new column................

              alter table tblname
              add columnname datatype(variablesize)

              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