Source: stackoverflow.com --- Saturday, October 22, 2016
I'm using Microsoft Sql server 2012 as DBMS, there I have my database which is containing informations about football players . Each player has a photography, and I need to export players photos to my computer, I guess it is possible to do it over TSQL, so I could avoid programming or editing my application to export photos only. Here is what I did so far: MY SQL CODE: EXEC sp_configure 'show advanced options', 1 GO RECONFIGURE GO EXEC sp_configure 'xp_cmdshell', 1 GO RECONFIGURE GO EXEC master..xp_cmdshell 'mkdir C:\ImagesFromSql' EXEC master..xp_cmdshell 'BCP "SELECT Photo FROM [FootballTeam].[dbo].[Players]" queryout "C:\ImagesFromSql\TestImage.jpg" -T -N' As you can see, my folder ImagesFromSql is created on "C:\", also one photo is stored there but intersting is that photo is 361MB big so probably that is size of all photos that are contained in database? And I am wondering how could I export all images from database instead of one in this case, and is it possible to set their names for example lets set Image name as PlayerID, for example 1.jpg, 2.jpg, 3.jpg....650.jpg... ...
from Microsoft http://ift.tt/2ehUkm2
No comments:
Post a Comment