Initialize a Table

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

    #1

    Initialize a Table


    Hi,

    I'd like to initialize a table.
    This is the code:

    With rstArtrprt
    If .State = 1 Then .Close
    .Open "Delete * From Artrprt", cnnOdbc, adOpenKeyset,
    adLockOptimisti c
    End With

    I get an Sql Syntax error. What should I do?


  • Bill Karwin

    #2
    Re: Initialize a Table

    Joel wrote:[color=blue]
    > "Delete * From Artrprt"
    > I get an Sql Syntax error. What should I do?[/color]

    There's no * syntax for the DELETE statement; there is no need for it,
    since you can't delete individual columns, you can only delete whole
    rows. You probably want "Delete From Artrprt".

    Review the documentation for DELETE for more information:
    http://dev.mysql.com/doc/mysql/en/DELETE.html

    Tip: when deleting the entire contents of a table, if there are a lot of
    data in the table, you might find it is quicker to use "DROP TABLE
    Artrprt" and then recreate it with your original "CREATE TABLE". Either
    way will work.

    Regards,
    Bill K.

    Comment

    • Joel

      #3
      Re: Initialize a Table


      Thank you Bill

      "Bill Karwin" <bill@karwin.co m> wrote in message
      news:csh5g501oc t@enews3.newsgu y.com...[color=blue]
      > Joel wrote:[color=green]
      > > "Delete * From Artrprt"
      > > I get an Sql Syntax error. What should I do?[/color]
      >
      > There's no * syntax for the DELETE statement; there is no need for it,
      > since you can't delete individual columns, you can only delete whole
      > rows. You probably want "Delete From Artrprt".
      >
      > Review the documentation for DELETE for more information:
      > http://dev.mysql.com/doc/mysql/en/DELETE.html
      >
      > Tip: when deleting the entire contents of a table, if there are a lot of
      > data in the table, you might find it is quicker to use "DROP TABLE
      > Artrprt" and then recreate it with your original "CREATE TABLE". Either
      > way will work.
      >
      > Regards,
      > Bill K.[/color]


      Comment

      Working...