Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 save any file

Author  Topic 

lilinikco
Starting Member

28 Posts

Posted - 2011-02-06 : 03:03:00
hi all.
I use below command for retrive varbinary column data and save to local pc,this command saved file with same size with original file,but not open file correctly.what I do for this problem?

declare @SQLcommand nvarchar(4000)

set @SQLcommand = 'bcp "SELECT Photo FROM Attachments WHERE [ImageName] = ''Picture.bmp'' " queryout "C:\PicutureOut.bmp" -T -N -SServerName'

exec xp_cmdshell @SQLcommand



lili@@
   

- Advertisement -