104 lines
5.3 KiB
Plaintext
104 lines
5.3 KiB
Plaintext
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_DBImportMMEPhysicalDimensions]') AND type in (N'P', N'PC'))
|
|
DROP PROCEDURE [dbo].[sp_DBImportMMEPhysicalDimensions]
|
|
GO
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_DBImportMMEPhysicalDimensions]') AND type in (N'P', N'PC'))
|
|
BEGIN
|
|
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_DBImportMMEPhysicalDimensions] AS'
|
|
END
|
|
GO
|
|
ALTER PROCEDURE [dbo].[sp_DBImportMMEPhysicalDimensions]
|
|
@MMEPhysicalDimensions xml
|
|
,@errorNumber int output
|
|
,@errorMessage nvarchar(250) output
|
|
AS
|
|
BEGIN
|
|
|
|
|
|
begin try
|
|
begin transaction tMMEPhysicalDimensions
|
|
insert into [dbo].[MMEPhysicalDimensions]
|
|
([s_GUID]
|
|
,[PHYSICAL_DIMENSION]
|
|
,[TEXT_L1]
|
|
,[TEXT_L2]
|
|
,[DEFAULT_UNIT]
|
|
,[LENGTH_EXP]
|
|
,[TIME_EXP]
|
|
,[MASS_EXP]
|
|
,[ELECTRIC_CURRENT_EXP]
|
|
,[TEMPERATURE_EXP]
|
|
,[LUMINOUS_INTENSITY_EXP]
|
|
,[AMOUNT_OFSUBSTANCE_EXP]
|
|
,[VERSION]
|
|
,[DATE]
|
|
,[REMARKS]
|
|
,[EXPIRED]
|
|
,[SORTKEY]
|
|
,[LAST_CHANGE]
|
|
,[LAST_CHANGE_TEXT]
|
|
,[HISTORY])
|
|
select
|
|
t.x.value('(./s_GUID)[1]', 'nvarchar(50)')
|
|
,t.x.value('(./PHYSICAL_DIMENSION)[1]', 'nvarchar(50)')
|
|
,t.x.value('(./TEXT_L1)[1]', 'nvarchar(50)')
|
|
,t.x.value('(./TEXT_L2)[1]', 'nvarchar(50)')
|
|
,t.x.value('(./DEFAULT_UNIT)[1]', 'nvarchar(50)')
|
|
,t.x.value('(./LENGTH_EXP)[1]', 'int')
|
|
,t.x.value('(./TIME_EXP)[1]', 'int')
|
|
,t.x.value('(./MASS_EXP)[1]', 'int')
|
|
,t.x.value('(./ELECTRIC_CURRENT_EXP)[1]', 'int')
|
|
,t.x.value('(./TEMPERATURE_EXP)[1]', 'int')
|
|
,t.x.value('(./LUMINOUS_INTENSITY_EXP)[1]', 'int')
|
|
,t.x.value('(./AMOUNT_OFSUBSTANCE_EXP)[1]', 'int')
|
|
,t.x.value('(./VERSION)[1]', 'int')
|
|
,t.x.value('(./DATE)[1]', 'datetime')
|
|
,t.x.value('(./REMARKS)[1]', 'nvarchar(50)')
|
|
,t.x.value('(./EXPIRED)[1]', 'bit')
|
|
,t.x.value('(./SORTKEY)[1]', 'nvarchar(50)')
|
|
,t.x.value('(./LAST_CHANGE)[1]', 'datetime')
|
|
,t.x.value('(./LAST_CHANGE_TEXT)[1]', 'nvarchar(50)')
|
|
,t.x.value('(./HISTORY)[1]', 'nvarchar(50)')
|
|
from @MMEPhysicalDimensions.nodes('/CustomPhysicalDimensions/PhysicalDimension') t(x)
|
|
OPTION (OPTIMIZE FOR ( @MMEPhysicalDimensions = NULL ))
|
|
|
|
commit transaction tMMEPhysicalDimensions
|
|
end try
|
|
begin catch
|
|
set @errorNumber = error_number()
|
|
set @errorMessage = error_message()
|
|
rollback transaction tMMEPhysicalDimensions
|
|
end catch;
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|