Im trying to copy an image from my xml to a nother DB of SQL-Server to a image field. I can encode my field but how do i save it back to a image column. !!


declare @data nvarchar(4000)
declare @handle int

--SELECT TOP 1 * FROM TblTypeSection for xml auto, binary base64

set @data = 'MY XML TAGS GOES HERE'

EXEC sp_xml_preparedocument @handle OUTPUT, @data
begin transaction
SELECT * FROM TblTypeSection WHERE IdTypeSection = 3886

INSERT into TblTypeSection SELECT [IdTypeSection], [sNomSection], [IdSectionSuperieur], [IdTypeSalle], [sCoteSection], isnull([bAfficheChoixSite],0), isnull([bFauteuilRoulant],0),
[ImgSection], [sDecoupage], isnull([bBilletNiveau],0), isnull([bBilletSection],0), [sCodeSection], isnull([bModeMeilleurBilet],0), isnull([bAdmissionGeneraleSection],0), isnull([iHauteurImageTypeSection],0)
FROM OPENXML (@handle, N'//TblTypeSection')
[IdTypeSection] [int] ,
[sNomSection] [nvarchar](50),
[IdSectionSuperieur] [int],
[IdTypeSalle] [int],
[sCoteSection] [nvarchar](2),
[bAfficheChoixSite] [bit],
[bFauteuilRoulant] [bit],
[ImgSection] [image],
[sDecoupage] [nvarchar](500),
[bBilletNiveau] [bit],
[bBilletSection] [bit],
[sCodeSection] [nvarchar](50),
[bModeMeilleurBilet] [bit],
[bAdmissionGeneraleSection] [bit],
[iHauteurImageTypeSection] [int]

SELECT * FROM TblTypeSection WHERE IdTypeSection = 3886
EXEC sp_xml_removedocument @handle