Passing huge amounts of data as an hexadecimal (0x123AB...) parameter of a clr stored procedure in s

Posted by user193655 on Stack Overflow See other posts from Stack Overflow or by user193655
Published on 2010-05-07T12:54:15Z Indexed on 2010/05/07 12:58 UTC
Read the original article Hit count: 144

Filed under:
|
|

I post this question has followup of This question, since the thread is not recieving more answers.

I'm trying to understand if it is possible to pass as a parameter of a CLR stored procedure a large amount of data as "0x5352532F...".

This is to avoid to send the data directly to the CLR stored procedure, instead of sending ti to a temporary DB field and from there passing it as varbinary(max) parmeter to the CLR stored procedure.

I have a triple question:

1) is it possible, if yes how? Let's say i want to pass a pdf file to the CLR stored procedure (not the path, the full bits that make up the file). Something like:

exec MyCLRStoredProcs.dbo.insertfile
@file_remote_path ='c:\temp\test_file.txt' ,
@file_contents=0x4D5A90000300000004000.... --(this long list is the file content)

where insertfile is a stored proc that writes to the server path (at file_remote_path) the binary data I pass as (file_contents).

2) is it there corruption risk of adopting this approach (or it is the same approach that sql server uses behind the scenes)?

3) how to convert the content of a file into the "0x23423..." hexadecimal representation

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sqlclr