create function fn_get_where_divor
(
@FLD nvarchar(70),
@QS nvarchar(4000),
@Div varchar(12),
@KIND bit,
@KEY nvarchar(36)
)
returns nvarchar(MAX)
as
begin
declare @result nvarchar(max)
declare @i int;
declare @cnt_array int
set @result = '('+@key +' IS NULL)';
set @cnt_array = BoardSample.dbo.Get_Array_Item(@QS, -1, @DIV)
set @i = 0
if(@QS = '')
begin
if(@KIND = 0)
SET @RESULT = '('+@key+' is NULL)'
else
SET @RESULT = '('+@key+' is not null)'
end
else
begin
while (@i < @cnt_array)
begin
set @result = @result + ' OR(' + @FLD + ' like''%' + rtrim(ltrim(BoardSample.dbo.Get_Array_Item(@QS, @i+1, @DIV))) + '%'')'
set @i = @i + 1
end
end
return @result
end
declare @where nvarchar(4000)
set @where = cafe_manage.dbo.fn_get_where_divor('name', '', ',',1, 'sn')
select @where
exec ('select * from member where ' + @where)
댓글 영역