hi all,
Not sure if there is an easier way to do this but this is my first ever Function I created so far. I am getting the error:
"Select statements included within a function cannot return data to a client"
All I am trying to do is ...if the date is NOT passed then apply NULL as the default value and run the SELECT statement.
If the date IS NOT null then run a different SELECT statement.
CREATE FUNCTION [SchemaTest].[fn_Test]
(
@instance as uniqueidentifier
,@date as datetime = null
)
RETURNS varchar(8000)
AS
BEGIN
If (@date is null) --@date = null ??
Begin
Select *
From Uds.RealtimeLogging
Where instanceID = @instance
End
Else
Begin
Select *
From Uds.RealtimeLogging
Where instanceID = @instance and [timeStamp] > @date
End
Return @stepIds
END
Thank you!JCD
View Complete Post