Visualizzazione dei risultati da 1 a 8 su 8
  1. #1
    Utente di HTML.it L'avatar di serena
    Registrato dal
    Jul 2001
    Messaggi
    138

    [VB6 - SQL] Copiare dati da una tab ad un'altra

    Ciao a tutti,
    sapete dirmi qual è il comando in sql per copiare una porzione di dati di un recordset ad un altro recordset con struttura uguale?

    tipo :
    INSERT INTO 'recordset1' FIELDS 'tutti' VALUE 'tutti quelli di recordset2'"

    senza dover per forza scrivere i nomi di tutti i fields.

    Grazie

  2. #2
    Utente di HTML.it L'avatar di sebamix
    Registrato dal
    Aug 2000
    Messaggi
    1,028
    Da SDK ODBC (reperibile su sito M$)
    Spero ti possa essere di aiuto.

    INSERT - SQL Command
    Appends a record to the end of a table that contains the specified field values.

    The Visual FoxPro ODBC Driver supports the native Visual FoxPro language syntax for this command. For driver-specific information, see Driver Remarks.

    Syntax

    INSERT INTO dbf_name [(fname1 [, fname2, ...])]
    VALUES (eExpression1 [, eExpression2, ...])
    Arguments

    INSERT INTO dbf_name
    Specifies the name of the table to which the new record is appended. dbf_name can include a path and can be a name expression.
    If the table you specify isn't open, it is opened exclusively in a new work area and the new record is appended to the table. The new work area isn't selected; the current work area remains selected.

    If the table you specify is open, INSERT appends the new record to the table. If the table is open in a work area other than the current work area, it isn't selected after the record is appended; the current work area remains selected.

    [(fname1 [, fname2 [, ...]])]
    Specifies in the new record the names of the fields into which the values are inserted.
    VALUES (eExpression1 [, eExpression2 [, ...]])
    Specifies the field values inserted into the new record. If you omit the field names, you must specify the field values in the order defined by the table structure.

  3. #3
    Ciao,

    prova con questo:

    INSERT INTO Copia_Tabella
    SELECT * FROM Originale_Tabella
    Giuseppe

  4. #4
    Utente di HTML.it L'avatar di serena
    Registrato dal
    Jul 2001
    Messaggi
    138
    Grazie Giuseppe, era quello che cercavo, ora provo.

  5. #5
    Utente di HTML.it L'avatar di darkblOOd
    Registrato dal
    Jul 2001
    Messaggi
    2,212
    ah ah ah, serena
    sai che devi usare la ricerca prima di postare no?

    http://forum.html.it/forum/showthrea...ht=insert+into




  6. #6
    Utente di HTML.it L'avatar di serena
    Registrato dal
    Jul 2001
    Messaggi
    138
    sapessi quante ricerche faccio...
    però anche il post a cui mi hai mandato (che avevo letto) mi dice come usare INSERT INTO definindo i valori uno per uno... la mia poca esperienza in sql non mi permetteva di arrivare a capire che SELECT * mi poteva copiare tutto... è che faccio delle routine pazzesche e mi inchiodo su delle cavolate... CHE NERVI!!

  7. #7
    Utente di HTML.it L'avatar di darkblOOd
    Registrato dal
    Jul 2001
    Messaggi
    2,212
    codice:
    INSERT INTO Tabella1 (SELECT * FROM Tabella2)
    Così però è necessario che le 2 tabelle abbiano gli stessi campi con gli stessi tipi di dati.


    Ciao ciao

  8. #8
    Utente di HTML.it L'avatar di serena
    Registrato dal
    Jul 2001
    Messaggi
    138
    infatti... ho risolto proprio così, come mi aveva suggerito Giuseppe.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.