CREATE PROCEDURE InsertUsersFromXML (
    @sXML NTEXT
)
AS
begin transaction
    DECLARE @iDoc INT
    EXEC sp_xml_preparedocument @iDoc OUTPUT, @sXML
                       
    INSERT INTO dbo.USERS (UserName, Password, Rights, UserKey,LocalUser,ConnectedConfigServiceID)
    SELECT UserName, Password, Rights,UserKey, LocalUser,ConnectedConfigServiceID
    FROM OPENXML(@iDoc,'/Users/dbo.Users',2)
    WITH (Username varchar(50) 'Username', 
          Password varchar(50) 'Password', 
          Rights int 'Rights', 
		  UserKey int 'UserKey',
		  LocalUser int 'LocalUser',
		  ConnectedConfigServiceID int 'ConnectedConfigServiceID');
	commit;
    EXEC sp_xml_removedocument @iDoc;
RETURN
