I have a stored procedure that goes something like
SELECT TOP (@TOPN) Field1, Field2, Field3
FROM Atable
WHERE Atable.Key = @Key
ORDER BY Something DESC
Without the TOP statement if I drag and drop this sp to the tables section it detects all the fields, and everything works fine, with the TOP (@TOPN) statement I get an error message saying that it cant deal with the Custom sql and the fields are note detected.
It seems that Scheme Modeler doesnt understand TOP.
To validate a SQL statement Schema Modeler sets all parameters in this statement to NULL and then tries to execute the statement. While this is not an issue for parameters in the WHERE clause, a statement like
SELECT TOP(NULL) ...
cannot be executed by the MS SQL server and so it is treated as non-valid.