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.sp_kurs_detail_insert
@PARAMETER xml=''
---XencX---with encryption
as
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
declare @pemisah nvarchar(255)
declare @pemisah_replace nvarchar(255)
set @pemisah_replace='<br />'
--set @pemisah=CHAR(13) + CHAR(10) + '
'
set @pemisah = '
'
declare @resultX nvarchar(max)
declare @resultX2 nvarchar(max)
declare @XmlSts xml
declare @raw xml
declare @xStsnoheader nvarchar(2),
@xStsno nvarchar(2),
@xStsdes nvarchar(max)
set @xStsnoheader='07'
set @xStsno='00';
set @xStsdes='sukses'
BEGIN TRY
SET NOCOUNT ON
DECLARE @NOW datetime
set @NOW =GETDATE()
declare @data_by nvarchar(20)
,@currenciesid bigint
,@headerid bigint
,@rate decimal(38,4)
,@id bigint
SELECT
@data_by=tempTable.item.value('data_by[1]', 'nvarchar(255)')
,@currenciesid=isnull(tempTable.item.value('currenciesid[1]', 'bigint'),0)
,@rate=isnull(tempTable.item.value('rate[1]', 'decimal(38,4)'),0)
,@headerid=isnull(tempTable.item.value('headerid[1]', 'bigint'),0)
,@id=isnull(tempTable.item.value('id[1]', 'bigint'),0)
FROM @PARAMETER.nodes('param/field') tempTable(item)
BEGIN TRANSACTION;
if @id != 0
begin
update dt_currencies set rate = @rate, editby = @data_by, editdate = getdate() where id = @id
end
else
begin
insert into dt_currencies(currenciesid, headerid, rate, createby, createdate)
values (@currenciesid, @headerid, @rate, @data_by, getdate())
end
COMMIT;
f:
set nocount off
END TRY
BEGIN CATCH
IF (@@TRANCOUNT > 0) ROLLBACK TRAN;
set @xStsno='88'
set @xStsdes= ERROR_MESSAGE()
END CATCH
g:
set @XmlSts=(select @xStsnoheader + @xStsno as 'no', @xStsdes as 'des' for xml path('sts'))
select CAST( (select @XmlSts,isnull(@raw ,'') for xml path ('result')
) as XML) as dt
GO
GO
CREATE procedure dbo.sp_kurs_detail_insert
@PARAMETER xml=''
---XencX---with encryption
as
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
declare @pemisah nvarchar(255)
declare @pemisah_replace nvarchar(255)
set @pemisah_replace='<br />'
--set @pemisah=CHAR(13) + CHAR(10) + '
'
set @pemisah = '
'
declare @resultX nvarchar(max)
declare @resultX2 nvarchar(max)
declare @XmlSts xml
declare @raw xml
declare @xStsnoheader nvarchar(2),
@xStsno nvarchar(2),
@xStsdes nvarchar(max)
set @xStsnoheader='07'
set @xStsno='00';
set @xStsdes='sukses'
BEGIN TRY
SET NOCOUNT ON
DECLARE @NOW datetime
set @NOW =GETDATE()
declare @data_by nvarchar(20)
,@currenciesid bigint
,@headerid bigint
,@rate decimal(38,4)
,@id bigint
SELECT
@data_by=tempTable.item.value('data_by[1]', 'nvarchar(255)')
,@currenciesid=isnull(tempTable.item.value('currenciesid[1]', 'bigint'),0)
,@rate=isnull(tempTable.item.value('rate[1]', 'decimal(38,4)'),0)
,@headerid=isnull(tempTable.item.value('headerid[1]', 'bigint'),0)
,@id=isnull(tempTable.item.value('id[1]', 'bigint'),0)
FROM @PARAMETER.nodes('param/field') tempTable(item)
BEGIN TRANSACTION;
if @id != 0
begin
update dt_currencies set rate = @rate, editby = @data_by, editdate = getdate() where id = @id
end
else
begin
insert into dt_currencies(currenciesid, headerid, rate, createby, createdate)
values (@currenciesid, @headerid, @rate, @data_by, getdate())
end
COMMIT;
f:
set nocount off
END TRY
BEGIN CATCH
IF (@@TRANCOUNT > 0) ROLLBACK TRAN;
set @xStsno='88'
set @xStsdes= ERROR_MESSAGE()
END CATCH
g:
set @XmlSts=(select @xStsnoheader + @xStsno as 'no', @xStsdes as 'des' for xml path('sts'))
select CAST( (select @XmlSts,isnull(@raw ,'') for xml path ('result')
) as XML) as dt
GO
Depends On
1Used By
No items found