0

this is pretty much a noob question but i can't find a solution.

I'm using a SQL Server Database. In one table a column has the DataType varbinary(max). The values for this column are shown a hex values(When i'm using a select - query). What is the best way to write the shown hex String completly into a text file?

Two Constraints: * Copy&Paste is not an Option. The value i want to extract has a length of approx. 69000 Chars. The Windows Clipboard seems to store only around 43000 Chars. * I've tried to save the query Result as a .csv File. But the maximum size for these files is around 65000 chars.

3
  • Why can't you query that column, store it in a StringBuffer and then write it to a File? Commented Feb 22, 2013 at 9:00
  • Would this answer help? stackoverflow.com/a/5172100/2061621 Commented Feb 22, 2013 at 9:03
  • Using transact SQL? Or Java? I've been using a small Java Program to query the value. But i don't know which method to call to get the hex value and not the bytes. Commented Feb 22, 2013 at 9:05

1 Answer 1

1

From the command line:

bcp "select * from [<yourtable>]" queryout C:\Temp\yourfile.dat -S yourserver -d yourDatabase -T -c

-T means a Trusted Connection; you can use -U and -P to supply a user name as password.

Sign up to request clarification or add additional context in comments.

1 Comment

Whooohoooo!!! :-) Works! Thanks. I've tried bcp yesterday but did not give the Database as an extra Parameter. I've had it in my query.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.