我想編寫一個存儲過程,以過濾其中一些可能爲空或NULL的某些列。下面的代碼是我的,但它不起作用。使用ltrim和itrim
procedure .[s p_organization](@expert nvarchar(100),
@name nvarchar(100), @last_name nvarchar(200),
@organization n varchar(200))
where
((Person.expert LIKE @expert or Person.expert LIKE @expert)
and (is null(l trim(r trim @last_name)),'')=''
or person.last_name like @last_name + '%'
and Person.Name LIKE @name
or @name is null
and Organization.Name LIKE N'%'[email protected] +'%')
「SELECT」子句在哪? –
這是無效的標準SQL。您正在使用哪些DBMS? –
查詢中存在太多的語法和邏輯錯誤 –