I am trying to create a function in sql server but it keeps telling me :
A RETURN statement with a return value cannot be used in this context.
I have many other functions and they all end with return @variable. So I must be doing something wrong here and I just can't see it.
Hopefully someone can spot what I am doing wrong here so I can get the function compiling and can complete it.
CREATE function fnGetToInvoiceLoads (@TruckID int, @ClientID int, @OpdrachtID int, @OpcID int, @VertrekIDs varchar(max), @BestemmingIDs varchar(max), @CarIDs varchar(max)) returns table as begin declare @Table table( RitChecked bit, RitID int, ClientID int ) return @Table end