The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Macro using dates for SQL
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:
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:
SET @fDate =%{themonth}
error message is "Operand type clash: int is incompatible with date."
How do I resolve this?
error message is "Operand type clash: int is incompatible with date."
How do I resolve this?
Tagged:
0
Best Answer
-
ecdbert Member Posts: 21 MavenUPDATE: I've resolved this by using 'concat' to add single quotes before and after the macro value in a 'Generate Macro' operator.1
Answers
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