sql script

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

    #1

    sql script

    Is it possible to run an sql script to add another column to an sql table
    from MS Access.
    If so how would I do it.
    Thanks
    Alec


  • Terry Kreft

    #2
    Re: sql script

    If you mean to a MS SQL Server table then yes you can do his in a number of
    ways.

    For exmple you can use
    A pass-through query
    ADO



    With a pass-through query you would
    a) create a new query
    b) cancel the dialog that appears
    c) Choose the Query/SQL Specific/Pass-Through menu otion
    d) Open the Query Properties dialog
    e) Enter a valid ODBC connection string
    f) Enter your ALTER TABLE sql
    g) Execute the query

    WIth ADO you would do something like

    Dim oC as ADODB.Connectio n
    Dim strSQl as string

    strSQL = "ALTER TABLE ..."

    Set oC = new ADODB.Connectio n
    With oC
    .ConnectionStri ng = "Provider=SQOLE DB.1;..."
    .Open
    .Execute strSQl
    .Close
    End With
    set oC = nothing


    --

    Terry Kreft


    "Paradigm" <alecjames1@hot mail.com> wrote in message
    news:Crung.4592 7$qD.26551@news fe1-gui.ntli.net...[color=blue]
    > Is it possible to run an sql script to add another column to an sql table
    > from MS Access.
    > If so how would I do it.
    > Thanks
    > Alec
    >
    >[/color]


    Comment

    • Lyle Fairfield

      #3
      Re: sql script


      Paradigm wrote:[color=blue]
      > Is it possible to run an sql script to add another column to an sql table
      > from MS Access.
      > If so how would I do it.
      > Thanks
      > Alec[/color]

      http://msdn2.microsoft.com/en-us/library/ms190273.aspx

      Comment

      • Paradigm

        #4
        Re: sql script

        Thanks
        What references do I need for ADO
        Alec

        "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message
        news:Yc6dnVu-jqcxDgPZSa8jmw@ karoo.co.uk...[color=blue]
        > If you mean to a MS SQL Server table then yes you can do his in a number[/color]
        of[color=blue]
        > ways.
        >
        > For exmple you can use
        > A pass-through query
        > ADO
        >
        >
        >
        > With a pass-through query you would
        > a) create a new query
        > b) cancel the dialog that appears
        > c) Choose the Query/SQL Specific/Pass-Through menu otion
        > d) Open the Query Properties dialog
        > e) Enter a valid ODBC connection string
        > f) Enter your ALTER TABLE sql
        > g) Execute the query
        >
        > WIth ADO you would do something like
        >
        > Dim oC as ADODB.Connectio n
        > Dim strSQl as string
        >
        > strSQL = "ALTER TABLE ..."
        >
        > Set oC = new ADODB.Connectio n
        > With oC
        > .ConnectionStri ng = "Provider=SQOLE DB.1;..."
        > .Open
        > .Execute strSQl
        > .Close
        > End With
        > set oC = nothing
        >
        >
        > --
        >
        > Terry Kreft
        >
        >
        > "Paradigm" <alecjames1@hot mail.com> wrote in message
        > news:Crung.4592 7$qD.26551@news fe1-gui.ntli.net...[color=green]
        > > Is it possible to run an sql script to add another column to an sql[/color][/color]
        table[color=blue][color=green]
        > > from MS Access.
        > > If so how would I do it.
        > > Thanks
        > > Alec
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Terry Kreft

          #5
          Re: sql script

          Microsoft ActiveX Data Objects x.x Library

          Replace x.x in the above line with the version number.

          --

          Terry Kreft


          "Paradigm" <alecjames1@hot mail.com> wrote in message
          news:ixMng.4906 7$qD.24225@news fe1-gui.ntli.net...[color=blue]
          > Thanks
          > What references do I need for ADO
          > Alec
          >
          > "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message
          > news:Yc6dnVu-jqcxDgPZSa8jmw@ karoo.co.uk...[color=green]
          > > If you mean to a MS SQL Server table then yes you can do his in a number[/color]
          > of[color=green]
          > > ways.
          > >
          > > For exmple you can use
          > > A pass-through query
          > > ADO
          > >
          > >
          > >
          > > With a pass-through query you would
          > > a) create a new query
          > > b) cancel the dialog that appears
          > > c) Choose the Query/SQL Specific/Pass-Through menu otion
          > > d) Open the Query Properties dialog
          > > e) Enter a valid ODBC connection string
          > > f) Enter your ALTER TABLE sql
          > > g) Execute the query
          > >
          > > WIth ADO you would do something like
          > >
          > > Dim oC as ADODB.Connectio n
          > > Dim strSQl as string
          > >
          > > strSQL = "ALTER TABLE ..."
          > >
          > > Set oC = new ADODB.Connectio n
          > > With oC
          > > .ConnectionStri ng = "Provider=SQOLE DB.1;..."
          > > .Open
          > > .Execute strSQl
          > > .Close
          > > End With
          > > set oC = nothing
          > >
          > >
          > > --
          > >
          > > Terry Kreft
          > >
          > >
          > > "Paradigm" <alecjames1@hot mail.com> wrote in message
          > > news:Crung.4592 7$qD.26551@news fe1-gui.ntli.net...[color=darkred]
          > > > Is it possible to run an sql script to add another column to an sql[/color][/color]
          > table[color=green][color=darkred]
          > > > from MS Access.
          > > > If so how would I do it.
          > > > Thanks
          > > > Alec
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...