Altair RISE
A program to recognize and reward our most engaged community members
Nominate Yourself Now!
Home
Discussions
Community Q&A
Macro using dates for SQL
ecdbert
Hi:
I'm trying to use a macro with date in an SQL statement but I'm getting an error from the SQL side. Here is part of the SQL statement:
Declare
@fDate
date,
@tdate
date ,
@processingdate
date,
@lag
int =%{lag}
SET
@fDate
=%{themonth}
error message is "Operand type clash: int is incompatible with date."
How do I resolve this?
Find more posts tagged with
AI Studio
SQL
Macros
Dates + Times
Accepted answers
ecdbert
UPDATE: I've resolved this by using 'concat' to add single quotes before and after the macro value in a 'Generate Macro' operator.
All comments
ecdbert
UPDATE: I've resolved this by using 'concat' to add single quotes before and after the macro value in a 'Generate Macro' operator.
BalazsBaranyRM
Hi,
that's a way to do it.
You can also add the single quotes inside the SQL string if you are not using the prepare functionality.
To make sure that you're not adding SQL injection vulnerabilities, you should use the "prepare statement" setting and enter your variable parameters in the form. Then RapidMiner will care for the correct quoting.
Regards,
Balázs
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)
Groups