Subject | Convert ms-sql to firebird openxml problem |
---|---|
Author | jclichthouse |
Post date | 2011-06-29T21:11:52Z |
Hi,
After a long search on google I stil have no clue how to convert this code.
[code]
ALTER PROCEDURE [dbo].[PhonePerson_TR]
(
@PersoonNr int
, @XmlPhone nvarchar(2000) = ''
, @user nvarchar(50)
, @returnValue int output
)
AS
BEGIN
if len(@XmlPhone) > 0
BEGIN
BEGIN TRY
/* ********** ********** BOF process xml ********** ********** */
-- Create a temp table to store xml info
DECLARE @TempTable table
(
PersoonNr int default -1
, TelefoonNr int default -1
, TelTypeNr smallint
, LandNr smallint
, NetNummer nvarchar(10) default -1
, AbonneeNr nvarchar(80) default -1
, used int default -1
)
DECLARE @XMLDoc INT
EXEC sp_xml_preparedocument @XMLDoc OUTPUT, @XmlPhone;
-- insert the xml in the temp table
INSERT INTO @TempTable (TelefoonNr, TelTypeNr, LandNr, NetNummer,
AbonneeNr)
SELECT TelefoonNr, TelTypeNr, LandNr, NetNummer, AbonneeNr
FROM OPENXML(@XMLDoc, '/DocumentElement/Phone',2)
WITH ( TelefoonNr INT
, TelTypeNR INT
, LandNr NVARCHAR(5)
, Netnummer nvarchar(10)
, AbonneeNr nvarchar(80)
);
-- Update the columns that are not used yet.
update @TempTable
set LandNr = null
, Netnummer = null;
/* ********** ********** EOF process xml ********** ********** */
-- more code using transactions
[/code]
Can you tel me how to get started, I have not much knowledge of fb yet.
any help is welcome
Edwin
After a long search on google I stil have no clue how to convert this code.
[code]
ALTER PROCEDURE [dbo].[PhonePerson_TR]
(
@PersoonNr int
, @XmlPhone nvarchar(2000) = ''
, @user nvarchar(50)
, @returnValue int output
)
AS
BEGIN
if len(@XmlPhone) > 0
BEGIN
BEGIN TRY
/* ********** ********** BOF process xml ********** ********** */
-- Create a temp table to store xml info
DECLARE @TempTable table
(
PersoonNr int default -1
, TelefoonNr int default -1
, TelTypeNr smallint
, LandNr smallint
, NetNummer nvarchar(10) default -1
, AbonneeNr nvarchar(80) default -1
, used int default -1
)
DECLARE @XMLDoc INT
EXEC sp_xml_preparedocument @XMLDoc OUTPUT, @XmlPhone;
-- insert the xml in the temp table
INSERT INTO @TempTable (TelefoonNr, TelTypeNr, LandNr, NetNummer,
AbonneeNr)
SELECT TelefoonNr, TelTypeNr, LandNr, NetNummer, AbonneeNr
FROM OPENXML(@XMLDoc, '/DocumentElement/Phone',2)
WITH ( TelefoonNr INT
, TelTypeNR INT
, LandNr NVARCHAR(5)
, Netnummer nvarchar(10)
, AbonneeNr nvarchar(80)
);
-- Update the columns that are not used yet.
update @TempTable
set LandNr = null
, Netnummer = null;
/* ********** ********** EOF process xml ********** ********** */
-- more code using transactions
[/code]
Can you tel me how to get started, I have not much knowledge of fb yet.
any help is welcome
Edwin