Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Extract Varbinary data using bcp

$
0
0

I am using Microsoft SQL Server 2008 R2. I have a varbinary column RelatedData_img in the table Reminderimage. In that column I store Word, Excel files, images (png, bmp or jpg format) or text files etc. Now I want to store data from that column to a disk using command. But the problem is I dont know in which row which file is saved. I want to extract all the contents of 'RelatedData_img' at a stretch.

I have tried to use this BCP command:

Initially I create a format file using,

Text
BCP '+QUOTENAME(DB_NAME())+'.dbo.test format nul -T -N -f "C:\Temp\xyz.fmt" -S PCname\SQLMANAGEMENT,25222 -Utest -Ptest
where test is a table which has varbinary column.
next i use the second command to extract data from varbinary column,
Text
BCP "SELECT TOP 1 RelatedData_img FROM Reminderimage.dbo.Reminderimage" QUERYOUT "D:\testing6" -T -fC "C:\Temp\xyz.fmt" -S...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>