Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Question Unanswered: create and drop table via vb

    How can i create and drop table in MS SQL Server 2000 via VB6? I think I should use ADOX object, but I don't know exactly how....
    The following code uses ADO connection object and returns with runtime error "incorrect syntax near AS":

    Dim db as ADODB.Connection
    '... open connection to database

    Dim strCmd As String

    strCmd = "CREATE TABLE tmp_tbl AS SELECT * FROM tbl"

    db.Execute strCmd

    Thank you in advance

  2. #2
    Join Date
    Sep 2003
    The extremely Royal borough of Kensington, London
    The code you are using works on an Oracle database. The syntax for SQL Server is "SELECT...INTO...FROM".
    SELECT * INTO newTable FROM oldTable
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts