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.