fikir
Programmer
- Jun 25, 2007
- 86
this query is taking time
select * from tbl1
where id in (select id from splitFunction(@listOfIds, ',')
or not exists(select id from splitFunction(@listOfIds, ',')
@listOfIds ia a variable with list of id's and what the query does is select ids if they exist in the list, but if the @listOfIds is null It will select every Id in the tbl1 table
split function splits the comma separated list into separate values
is there a better way to write the statement
Thanks,
select * from tbl1
where id in (select id from splitFunction(@listOfIds, ',')
or not exists(select id from splitFunction(@listOfIds, ',')
@listOfIds ia a variable with list of id's and what the query does is select ids if they exist in the list, but if the @listOfIds is null It will select every Id in the tbl1 table
split function splits the comma separated list into separate values
is there a better way to write the statement
Thanks,