I am trying to write a user defined function to get around the SELECT
SP2
I am getting an error msg 443: Invalid use of 'UNKNOWN TOKEN' within a
function. I am sure this is being caused by the SET ROWCOUNT because
when I comment them out, the udf compiles and runs just fine.
I am sure I can SET ROWCOUNT in the Stored Proc that will be using
this udf, but that sort of defeats the purpose of writing the function
in the first place.
Am I making a simple mistake here, or is the use of SET ROWCOUNT
invalid inside of a udf?
Here is the code for the udf:
use pubs
go
CREATE FUNCTION udf_Top_N_AuthID
BEGIN
au_id DESC
SET ROWCOUNT 0
RETURN
END
go
SELECT * FROM pubs.dbo.udf_Top_N_AuthID(1)
go
DROP FUNCTION udf_Top_N_AuthID
GO