makeSQL_createTable: generate SQL script to create table in SQL database from...

Description Usage Arguments Value Examples

Description

Creates a sql Query that will create a table in a SQL Database from an R dataframe. It intializes with variable types (naively), but prevents the user from manually writing the query, which can be especially cumbersome when there are many columns. Initialized with basic SQL Server variable types.

Usage

1
2
makeSQL_createTable(df, tablename = deparse(substitute(df)),
  saveQuery = NULL, wordy = T)

Arguments

df

data.frame we will generate a SQL create table script for

tablename

(optional) name of the table we want to create in a sql database

saveQuery

(optional) name and filepath of the .sql script that will create the table.

wordy

(optional) prints the sql query out to the console.

Value

sql query which the create table script

Examples

1
2
3
4
5
makeSQL_createTable(mtcars)
 ## Not run: 
 makeSQL_createTable(mtcars, saveQuery='mySQL_query.sql')
 
## End(Not run)

brooksandrew/Rsenal documentation built on May 13, 2019, 7:50 a.m.