c# - Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be done? -


store byte[] stored in sql xml parameter varbinary(max) field in sql server 2005. can done ?

here's stored procedure:

set ansi_nulls on set quoted_identifier on go  alter   procedure [dbo].[addperson]  @data xml    insert persons (name,image_binary)  select    rowwals.value('./@name', 'varchar(64)') [name],   rowwals.value('./@imagebinary', 'varbinary(max)') [imagebinary]     @data.nodes ('/data/names') b(rowvals)   select scope_identity() id 

in schema name of type string , imagebinary o type byte[]. should use string type imagebinary ? need specially encode string somehow ?

assuming use base64 byte[] in xml, approach uses xquery described in following article should work:

http://blogs.msdn.com/sqltips/archive/2008/06/30/converting-from-base64-to-varbinary-and-vice-versa.aspx


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -