Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
| Name | Data Type | Length | Description |
|---|---|---|---|
| @PARAMETER | xml | -1 |
SQL Script
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
create procedure dbo.MG_MS_FIND_TYPE_PROCCESS
@PARAMETER xml=''
---XencX---with encryption
as
SET NOCOUNT ON
declare @xStsnoheader varchar(2),
@xStsno varchar(2),
@xStsdes varchar(100)
set @xStsnoheader='05'
set @xStsno='00';
set @xStsdes='sukses'
declare @XmlSts xml
declare @raw xml
declare @findtext varchar(255),
@rows int
SELECT
@findtext=ltrim(rtrim(isnull(tempTable.item.value('findtext[1]', 'varchar(255)'),''))) ,
@rows=isnull(tempTable.item.value('rows[1]', 'int'),0)
FROM @PARAMETER.nodes('param/field') tempTable(item)
-- CHECK supp_code_old
DECLARE @SQLString nvarchar(2000);
DECLARE @ParmDefinition nvarchar(1000);
SET @findtext= replace(@findtext ,'[', '[[]')
SET @findtext= replace(@findtext ,'''', '''''')
SET @findtext= replace(@findtext ,'%','[%]')
SET @findtext= replace(@findtext ,'_','[_]')
SET @findtext= replace(@findtext ,'*','%')
declare @TOP varchar(100);
declare @xcari varchar(60)
declare @where varchar(1000)
declare @tp_find_id_int tp_find_id_int
if @rows>0
begin
--if ISNUMERIC(@findtext)=1 and len(@findtext)>0
--begin
-- if (select count(*) from @tp_find_id_int)<@rows
-- begin
-- insert into @tp_find_id_int(id, name)
-- SELECT ms_type_prosses_id, ms_type_prosses_name
-- FROM dt_ms_type_prosses
-- where (ms_type_prosses_id = @findtext)
-- and not exists (
-- select * from @tp_find_id_int as xfilter
-- where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
-- )
-- order by ms_type_prosses_id desc, len(isnull(ms_type_prosses_id,''))
-- end
--end
--if ISNUMERIC(@findtext)=1 and len(@findtext)>0
--begin
-- if (select count(*) from @tp_find_id_int)<@rows
-- begin
-- insert into @tp_find_id_int(id, name)
-- SELECT ms_type_prosses_id, ms_type_prosses_name
-- FROM dt_ms_type_prosses
-- where (cast(ms_type_prosses_id as varchar(255)) like @findtext + '%')
-- and not exists (
-- select * from @tp_find_id_int as xfilter
-- where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
-- )
-- order by ms_type_prosses_id desc, len(isnull(cast(ms_type_prosses_id as varchar(255)),''))
-- end
--end
if (select count(*) from @tp_find_id_int)<@rows
begin
insert into @tp_find_id_int(id, name)
SELECT ms_type_prosses_id, ms_type_prosses_name
FROM dt_ms_type_prosses
where (ms_type_prosses_name like @findtext + '%')
and len(isnull(ms_type_prosses_name,''))>0
and not exists (
select * from @tp_find_id_int as xfilter
where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
)
order by ms_type_prosses_name asc, len(isnull(ms_type_prosses_name,''))
end
--if ISNUMERIC(@findtext)=1 and len(@findtext)>0
--begin
-- if (select count(*) from @tp_find_id_int)<@rows
-- begin
-- insert into @tp_find_id_int(id, name)
-- SELECT ms_type_prosses_id, ms_type_prosses_name
-- FROM dt_ms_type_prosses
-- where (cast(ms_type_prosses_id as varchar(255)) like '%' + @findtext + '%')
-- and not exists (
-- select * from @tp_find_id_int as xfilter
-- where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
-- )
-- order by ms_type_prosses_id desc, len(isnull(cast(ms_type_prosses_id as varchar(255)),''))
-- end
--end
if (select count(*) from @tp_find_id_int)<@rows
begin
insert into @tp_find_id_int(id, name)
SELECT ms_type_prosses_id, ms_type_prosses_name
FROM dt_ms_type_prosses
where (ms_type_prosses_name like '%' + @findtext + '%')
and len(isnull(ms_type_prosses_name,''))>0
and not exists (
select * from @tp_find_id_int as xfilter
where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
)
order by ms_type_prosses_name asc, len(isnull(ms_type_prosses_name,''))
end
if (select count(*) from @tp_find_id_int)<@rows
begin
insert into @tp_find_id_int(id, name)
SELECT ms_type_prosses_id, ms_type_prosses_name
FROM dt_ms_type_prosses
where not exists (
select * from @tp_find_id_int as xfilter
where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
)
order by ms_type_prosses_name asc, len(isnull(ms_type_prosses_name,''))
end
end
set @raw=(
select
id as rID ,
name as r1
from @tp_find_id_int
for xml path ('xrow'))
SET NOCOUNT OFF
f:
set @XmlSts=(select @xStsnoheader + @xStsno as 'no', @xStsdes as 'des' for xml path('sts'))
select CAST( (select @XmlSts,@raw for xml path ('result')
) as XML) as dt
GO
GO
create procedure dbo.MG_MS_FIND_TYPE_PROCCESS
@PARAMETER xml=''
---XencX---with encryption
as
SET NOCOUNT ON
declare @xStsnoheader varchar(2),
@xStsno varchar(2),
@xStsdes varchar(100)
set @xStsnoheader='05'
set @xStsno='00';
set @xStsdes='sukses'
declare @XmlSts xml
declare @raw xml
declare @findtext varchar(255),
@rows int
SELECT
@findtext=ltrim(rtrim(isnull(tempTable.item.value('findtext[1]', 'varchar(255)'),''))) ,
@rows=isnull(tempTable.item.value('rows[1]', 'int'),0)
FROM @PARAMETER.nodes('param/field') tempTable(item)
-- CHECK supp_code_old
DECLARE @SQLString nvarchar(2000);
DECLARE @ParmDefinition nvarchar(1000);
SET @findtext= replace(@findtext ,'[', '[[]')
SET @findtext= replace(@findtext ,'''', '''''')
SET @findtext= replace(@findtext ,'%','[%]')
SET @findtext= replace(@findtext ,'_','[_]')
SET @findtext= replace(@findtext ,'*','%')
declare @TOP varchar(100);
declare @xcari varchar(60)
declare @where varchar(1000)
declare @tp_find_id_int tp_find_id_int
if @rows>0
begin
--if ISNUMERIC(@findtext)=1 and len(@findtext)>0
--begin
-- if (select count(*) from @tp_find_id_int)<@rows
-- begin
-- insert into @tp_find_id_int(id, name)
-- SELECT ms_type_prosses_id, ms_type_prosses_name
-- FROM dt_ms_type_prosses
-- where (ms_type_prosses_id = @findtext)
-- and not exists (
-- select * from @tp_find_id_int as xfilter
-- where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
-- )
-- order by ms_type_prosses_id desc, len(isnull(ms_type_prosses_id,''))
-- end
--end
--if ISNUMERIC(@findtext)=1 and len(@findtext)>0
--begin
-- if (select count(*) from @tp_find_id_int)<@rows
-- begin
-- insert into @tp_find_id_int(id, name)
-- SELECT ms_type_prosses_id, ms_type_prosses_name
-- FROM dt_ms_type_prosses
-- where (cast(ms_type_prosses_id as varchar(255)) like @findtext + '%')
-- and not exists (
-- select * from @tp_find_id_int as xfilter
-- where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
-- )
-- order by ms_type_prosses_id desc, len(isnull(cast(ms_type_prosses_id as varchar(255)),''))
-- end
--end
if (select count(*) from @tp_find_id_int)<@rows
begin
insert into @tp_find_id_int(id, name)
SELECT ms_type_prosses_id, ms_type_prosses_name
FROM dt_ms_type_prosses
where (ms_type_prosses_name like @findtext + '%')
and len(isnull(ms_type_prosses_name,''))>0
and not exists (
select * from @tp_find_id_int as xfilter
where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
)
order by ms_type_prosses_name asc, len(isnull(ms_type_prosses_name,''))
end
--if ISNUMERIC(@findtext)=1 and len(@findtext)>0
--begin
-- if (select count(*) from @tp_find_id_int)<@rows
-- begin
-- insert into @tp_find_id_int(id, name)
-- SELECT ms_type_prosses_id, ms_type_prosses_name
-- FROM dt_ms_type_prosses
-- where (cast(ms_type_prosses_id as varchar(255)) like '%' + @findtext + '%')
-- and not exists (
-- select * from @tp_find_id_int as xfilter
-- where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
-- )
-- order by ms_type_prosses_id desc, len(isnull(cast(ms_type_prosses_id as varchar(255)),''))
-- end
--end
if (select count(*) from @tp_find_id_int)<@rows
begin
insert into @tp_find_id_int(id, name)
SELECT ms_type_prosses_id, ms_type_prosses_name
FROM dt_ms_type_prosses
where (ms_type_prosses_name like '%' + @findtext + '%')
and len(isnull(ms_type_prosses_name,''))>0
and not exists (
select * from @tp_find_id_int as xfilter
where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
)
order by ms_type_prosses_name asc, len(isnull(ms_type_prosses_name,''))
end
if (select count(*) from @tp_find_id_int)<@rows
begin
insert into @tp_find_id_int(id, name)
SELECT ms_type_prosses_id, ms_type_prosses_name
FROM dt_ms_type_prosses
where not exists (
select * from @tp_find_id_int as xfilter
where dt_ms_type_prosses.ms_type_prosses_id=xfilter.id
)
order by ms_type_prosses_name asc, len(isnull(ms_type_prosses_name,''))
end
end
set @raw=(
select
id as rID ,
name as r1
from @tp_find_id_int
for xml path ('xrow'))
SET NOCOUNT OFF
f:
set @XmlSts=(select @xStsnoheader + @xStsno as 'no', @xStsdes as 'des' for xml path('sts'))
select CAST( (select @XmlSts,@raw for xml path ('result')
) as XML) as dt
GO
Depends On
1Used By
No items found