Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 780759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:07:34+00:00 2026-05-14T20:07:34+00:00

I post this question has followup of This question , since the thread is

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:07:35+00:00Added an answer on May 14, 2026 at 8:07 pm

    What is your goal? Are you trying to transfer a file from the client filesystem to the server filesystem? If so, you might want to look at a web service file transfer mechanism.

    Do you want to persist the data into the database? If so, and you have access to SQL Server 2008, I recommend looking at the new FILESTREAM type. This type maintains the link between the database and the file system for you.

    Alternatively, if you don’t have SQL Server 2008, you get to choose between saving it as a file and maintaining a string path to it in the database or storing the contents of a file in a VARBINARY(MAX) column.

    If all you want is to get the data into the database, you don’t need a CLR proc. You can save it directly to the database, or you can code a SQL stored proc to do so.

    Assuming you keep the approach of sending this to a CLR proc:

    1) is it possible, if yes how?

    Sure, why not. The code you wrote looks like a good example. The stored proc will need to convert the string into bytes.

    2) is it there corruption risk of adopting this approach

    I’m not sure what you mean here. Will SQL Server randomly replace characters in your string? No. Might you accidentally hit some sort of limit? Yes, possibly; the maximum size of NVARCHAR(MAX) is 2^31-1, or 2,147,483,647 characters. But I doubt you’d have a PDF that size. Might you lose the link between the file on disk and the database path to it? Yes, though FILESTREAM should take care of that for you.

    3) how to convert the content of a file into the “0x23423…” hexadecimal representation

    There are many examples on the Internet on how to do this. Here’s one:

    How do you convert Byte Array to Hexadecimal String, and vice versa?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

( I don't know whether should I also post this question to ServerFault, since
I am not sure if I can post this sort of question (apologies in
This is a followup/post question to another question; as I have discovered a solution
This is my first post, so please forgive me if this question has been
This question has some relation to this post I made recently: Drag a UIView
Yes, I'm aware that this question has already been post, but ... I'm looking
I know this question has been asked before but the solutions did not work
I know this question has been asked multiple times (however, I could still not
This question has been asked more then once, but somehow I don't get things
I know many question has been post and answer for this question. I still

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.