Ad-hoc retreival of data from SQL Server varbinary column -


i retreive binary data varbinary(max) column in sql server database debugging purposes.

what easiest way data local binary file, preferably without having write throw-away console application?

i have tried using sql server management studio (with "results file" option) outputs hex encoded binary string file, rather raw binary data.

i've found this solution bcp command (run command prompt):

c:\temp>bcp "select myvarbinarycol mytable id = 1234" queryout "c:\filename.pdf" -s mysqlserver\myinstance -t  enter file storage type of field filedata [varbinary(max)]: enter prefix-length of field filedata [8]: 0 enter length of field filedata [0]: enter field terminator [none]:  want save format information in file? [y/n] n  starting copy...  1 rows copied. network packet size (bytes): 4096 clock time (ms.) total : 15 average : (66.67 rows per sec.) 

i used -t option use windows authentication connect db. if use password auth, you'll need use -u , -p switches specify username , password.

but linqpad suggestion in robb sadler's answer , somehow prefer it.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

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