I have written this query wich is taking lots of time to run
I have a table valued function which returns a list of id's
I want to get recordset from table1
if @val_value is null then all records from table1 will be returned otherwise, only for those id's from the table function
What will be the most optimized way to do it
declare @val_value varchar(100)
select a.*
from tbl1 tbl
where
(@val_value is null OR
tbl.id in (select id from fn_tableFun(@val_value)
)
Thanks
I have a table valued function which returns a list of id's
I want to get recordset from table1
if @val_value is null then all records from table1 will be returned otherwise, only for those id's from the table function
What will be the most optimized way to do it
declare @val_value varchar(100)
select a.*
from tbl1 tbl
where
(@val_value is null OR
tbl.id in (select id from fn_tableFun(@val_value)
)
Thanks