R/bcp.R
mapDataTypes.Rd
Determine SQL Server data types from data frame. Follows SQL Server data type size constraints and chooses the smallest data type size.
mapDataTypes(x, coltypes)
varChar(x)
varBinary(x)
int(x)
data.frame object
vector with names of columns to override the default data type mapping
character vector with names of columns
mapDataTypes(data.frame(
int = 1:5L,
numeric = seq(0, 1, length.out = 5),
character = LETTERS[1:5],
factor = paste(LETTERS[1:5], LETTERS[1:5], sep = ''),
logical = c(TRUE, FALSE, TRUE, FALSE, TRUE),
date = seq(Sys.Date() - 4, Sys.Date(), 1L),
datetime = seq(Sys.time() - 5, Sys.time(), length.out = 5)
)
)
#> int numeric character factor logical date
#> "TINYINT" "FLOAT" "VARCHAR(1)" "VARCHAR(2)" "BIT" "DATE"
#> datetime
#> "DATETIME"