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. Answer Look for field.types
Tag: r
R : x comparison (1) is possible only for atomic and list types
I am using R. In a previous post (R: Loop Producing the Following Error: Argument 1 must have names), I learned how to make a function (“create_data”) for my code. Now, I am trying to modify this function. First, I create some data to be used for this example: Here is the modified version of the function: The error results
Adding rows to a table respecting the key columns structure
I have a very large table, which follows these structure (I past it here simplified): Product Line Name Quantity Unit Cost Pepe 10000 Lucia 4 UD 8 Pepe 20000 Santiago 7 UD 5.5 Pepe 30000 Mariangeles 10 KG 6 Antonio 10000 Naiara 4 KG 8 Antonio 20000 Toni 7 KG 3 Vanesa 10000 Lucia 4 UD 8 Vanesa 20000 Santiago
Check if rows exists in SQL Server using R and then Insert or Update rows
I have a table with the below structure. ID Entity UserName UserRole UserStatus UpdatedDate Clustered key is defined on columns Entity, UserName, UserRole. UserStatus for an Entity-UserName-UserRole …
How can I automatically add an additional apostrophe when entered by a user so as to not break their query?
I have a function where users specify start date (sd), end date (ed) and site in order to produce a graph. I have built a query that inputs the values entered accordingly; however, whenever site contains an apostrophe, it naturally breaks the query. In order to allow apostrophes within SQL queries, you must add it twice (i.e. Dave’s Site becomes
Create new Event_ID based on ID with sliding window on date column
Imagine I have a table like ID Date 1 2021-01-01 1 2021-01-05 1 2021-01-17 1 2021-02-01 1 2021-02-18 1 2021-02-28 1 2021-03-30 2 2021-01-01 2 2021-01-14 2 2021-02-15 I want to select all data on this table, but creating a new column with a new Event_ID. An Event is defined as all the rows with the same ID, within a
Error in as.character(query) : cannot coerce type ‘closure’ to vector of type ‘character’
I was trying to load some data from the oracle database, During the proceeding every line of code was fine until I try to run the last line: df<- sqlQuery(sql_connection,sql_statement,stringsAsFactors=0), an error in the title occurred. So here is the basic structure of my code: since I’m new to R, I don’t feel I can tell where is the cause
Return only last statement from Snowflake SQL query to R
I’ve got a Snowflake SQL query I’m trying to execute in R via ODBC connection that looks like this Querying Microsoft SQL Server from R I’d normally include set nocount no; at the top of the query to ensure only the last step is returned to R to avoid the error Actual statement count 6 did not match the desired
SQL query to get data without hours in timestamp column
I have written a code and sql query to get data from database: I get this dataframe: I want to write another query to get data only for 2019-05-29: but it brings me an error: How could i do that? How could i get rid of hours in timestamp column in my sql query? Desired result is: Answer toDate(timestamp) SELECT
Extract XML sqlQuery Issues in R – Querying Clob Column
I have a oracle DB table called CRS.CRS_FILES, with a column called FILE_DATA -inside that CLOB column is a large XML string. Here is the first few lines of it: it is set up with the following Xpath I want to query: I am not sure what I am doing – I know that sqlQuery when passing SQL queries there