Hi friendsI write this stored procedure for searching. @docdtl nvarchar(50)=null, @facnum nvarchar(50)=null, @creditor int, @debtor int, @office intASDECLARE @Cmd nvarchar(4000), @Where nvarchar(4000)set @Where='Where OfficeID=@office 'set @Cmd='select * from Document 'if NOT @docdtl Is NULLset @Where='DocDetails ='+@docdtlif NOT @facnum Is NULL beginif @Where <>''set @Where=@Where+' and 'set @Where=@Where+'FacNum ='+@facnumENDif Not @creditor Is Null Beginif @Where <>''set @Where=@Where+' and 'set @Where=@Where+'Creditor ='+@creditorEndif Not @debtor Is Null Beginif @Where<>''set @Where=@Where+' and 'set @Where=@Where+'Debtor ='+@debtorEndif @Where <>''set @Cmd=@Cmd+' Where '+@WhereExec(@Cmd)
but I have this error:Conversion failed when converting the nvarchar value 'Where OfficeID=@office and Creditor =' to data type int.
where is my problem?Sara Dajer