Skip to content
Advertisement

How can I change vartypes of a SQL table from R using ODBC package?

This works, however I want to change the sepal.width to decimal(28,0). Is it possible to do it before writing to SQL, or can I modify the SQL table to change the column type from R?

I know I can use RODBC, but I am forced to use R Version 3.6, so it is not an option.

Advertisement

Answer

Look for field.types when you read ?dbWriteTable.

Without:

With:


Tested using docker and the microsoft/mssql-server-linux image:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement