sqlCopy                package:RODBC                R Documentation

_O_D_B_C _C_o_p_y

_D_e_s_c_r_i_p_t_i_o_n:

     Functions to copy tables or result sets from one database to
     another.

_U_s_a_g_e:

     sqlCopy(channel, query, destination, destchannel = channel,
             verbose = FALSE, errors = TRUE, ...)

     sqlCopyTable(channel, srctable, desttable, destchannel = channel,
                  verbose = FALSE, errors = TRUE)

_A_r_g_u_m_e_n_t_s:

channel, destchannel: connection handle as returned by 'odbcConnect'.

   query: any valid SQL statement

destination, srctable, desttable: character: a database table name
          accessible from the connected dsn.

 verbose: Display statements as they are sent to the server?

  errors: if TRUE halt and display error, else return '-1'.

     ...: additional arguments to be passed to 'sqlSave'.

_D_e_t_a_i_l_s:

     'sqlCopy' as is like 'sqlQuery', but saves the output of 'query'
     in table 'destination' on channel 'destchannel'.

     'sqlCopyTable' copies the structure of 'srctable' to 'desttable'
     on dsn 'destchannel'.  This is within the limitations of the ODBC
     lowest common denominator.  More precise control is possible via
     'sqlQuery'.

_V_a_l_u_e:

     See 'sqlGetResults'.

_A_u_t_h_o_r(_s):

     Michael Lapsley and Brian Ripley

_S_e_e _A_l_s_o:

     'sqlQuery', 'sqlSave'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     ## example for a l/casing DBMS
     sqlSave(channel, USArrests, rownames = "state")
     query <- paste("select state, murder from usarrests",
                    "where rape > 30", "order by murder")
     sqlCopy(channel, query, "HighRape", rownames = FALSE)
     sqlFetch(channel, "HighRape", rownames = "state", max = 5)
     sqlDrop(channel, "HighRape")
     ## End(Not run)

