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
If (@date is null) --@date = null ??
Where instanceID = @instance
Where instanceID = @instance and [timeStamp] > @date
View Complete Post