I'm running some C# code inside of a CLR Function and running into some strange behavior.
When the following code runs:
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "SELECT * FROM Vertica_GetVerticaServer_vw WHERE verticaServer IS NOT NULL ORDER BY NEWID()";
using (cmd.Connection = GetSQLConnection())
SqlDataReader r = cmd.ExecuteReader();
This error is thrown (full relevant stack trace below):
Select statements included within a function cannot return data to a client.
However, when I run the same code, minus the "ORDER BY NEWID()" (used to randomize the result) and instead run the "ORDER BY NEWID()" inside of the view, I get no errors: Anyone know what's going on here?