>>Hi All,
>>
>>how can i use this line Iif(Empty(thisform.txtID.Value),'.t.','CrsTable.ID=thisform.txtID.value') in T-Sql where clause?
>>
>>Thanks
>
>Solved myself :)
>
>WHERE vw_CrsStokhb.fiskodu = CASE WHEN @fiskodu is not null then @fiskodu ELSE vw_CrsStokhb.fiskodu END
If I read all the names right. you may consider a simpler alternative:
WHERE @fiskodu IS NULL OR vw_CrsStokhb.fiskodu = @fiskodu
(but, in fact, if you can anticipate the nullity of fiskodu before create or issue the SQL statement - it's a parameter, right? - then it shouldn't be necessary to put the condition inside the WHERE clause, and instead build the SQL statement from scratch, with or without the WHERE clause, thus considering the two hypothesis).
----------------------------------
António Tavares Lopes