Getting error unnest is not a recognized built-in function name? - sql

When I'm running a query using 'unnest' statement getting error unnest is not a recognized built-in function name. Is unnest is builtin sql function name? is so it's compatible versions are ?

Related

How to use LEAST function in Calcite SQL with Apache Beam

I'm trying to call the LEAST function in Calcite SQL in my Apache Beam pipeline:
...
,LEAST(12.5 + (25 * Quartile), 100) AS PlayedPercentage
...
Where Quartile is an int32 column. I get the below error:
Caused by: org.apache.beam.vendor.calcite.v1_20_0.org.apache.calcite.sql.validate.SqlValidatorException: No match found for function signature LEAST(<NUMERIC>, <NUMERIC>)
I've also tried to cast both arguments to Float, but get the same result. How am supposed to call the fuction?
According to Calcite's SQL Reference, LEAST is a dialect-specific operator that is only enabled in the Oracle operator table.
If you were connecting to Calcite directly, I would suggest that include fun=oracle in the JDBC connect string, and this will enable the Oracle operator table. I'm not sure what the steps are if you are using Calcite from within Beam.

How i can use REGEXP_REPLACE in SQL Server

I asked a question but answer is not usable on my computer.
How i can Replace Only first Result in SQL Function
here, the result is using REGEXP_REPLACE function but I cant use it on SSMS 18
it is getting this error;
REGEXP_REPLACE is not a recognized built-in function name
How I can use this function?

Oracle math functions

I am trying to get a rounded value in Oracle (using SQL Developer) through following statement:
ROUND((1-POWER((SUM(D.PFY/100*E.OUT_8_)/SUM(E,OUT_8_)), (1/(SUM(PHOTO*E.OUT_8_)/SUM(E.OUT_8_)))))*1000000, 0) AS PFYPPM
However, I am getting an error as:
invalid number of arguments.
What is it that I am doing wrong?
Sometimes Oracle error messages are actually helpful.
invalid number of arguments
Check your function calls.
sum() takes only one argument.
SUM(E,OUT_8_)
should probably be
SUM(E.OUT_8_)

REGEXP_MATCH in BigQuery Standard SQL

Although the BigQuery Standard SQL documentation mentions the function REGEXP_MATCH[1], it seems to be unavailable when running a query, with the web interface returning:
Error: Function not found: REGEXP_MATCH
What would be an alternative to using it?
[1] https://cloud.google.com/bigquery/sql-reference/functions-and-operators#regexp_match
what would be an alternative to using it?
You should use REGEXP_CONTAINS

Can I cast inside a sqlserver containsregex?

I'm using an older PHP driver for mssql and am trying to filter out results using the ContainsRegExp command. The issue is that the field I'm comparing is ntext and it causes the query to fail. Is it possible to do a cast inside the ContainsRegExp command somthing like:
... AND Field1.ContainsRegExp(CAST(Field1 AS TEXT) AS Field1Test,\'html\')=1';
The full query statement:
'SELECT ReportID, ReportDate, CAST(ReportData AS TEXT) AS TextData FROM Database WHERE ReportData.ContainsRegExp(CAST(ReportData AS TEXT),\'html\')=1';
The error I see is:
message: Cannot call methods on ntext. (severity 15)
ContainsRegExp is not a standard SQL Server command. So I'm not really sure how you've arrived at that statement, but it's not T-SQL.
My guess is that somewhere along the line a similar command has been used with a CLR type - because the syntax you are using (Field.Operation()) is used for calling methods on CLR types.