December 18, 2004 at 8:20 am
Hello All
I want to store some photos in a MSSQL database, and to view them later
what is the best way to do it, do i need any speical fields etc,
I am using Delphi 5.
Thanks in advance
Merry christmas to all
Steve
December 19, 2004 at 11:49 pm
There is a very handy executable... textcopy.exe that took me ages to find but does what you want..
If you do textcopy.exe /? you will get lots of help on it. I am putting in a copy of the stored procedure I use to do the output... I also use something similiar to get pictures out of Oracle into .jpg format to dump to file..
CREATE Procedure sp_imp_exp_images
(
-- M. Girdler
-- Kangan Batman TAFE
-- stored procedure to output .jpg from sql server
-- id = picture identifier
-- path = path of the picture to be output to or gotten from
-- 'sa' = using the sa account (naughty i know....)
-- The 'O' at the end after the '/' means that it is for Output..
@id varchar(6) ,
@path varchar(50)
)
AS
declare @cmd varchar(1000)
set @cmd = 'e:\photos\textCopy.exe' + ' /S ' + '<sql server>' + ' /D ' + '<database name>' + ' /U ' + 'sa' +
' /P ' + '<sa - password>'+ ' /T ' + '<table name>' + ' /C ' + '<field name>' + ' /W ' + '"where id =' + @id + '"' + ' /F ' + @path + @id + '.jpg' + ' /' + 'O'
exec Master..xp_cmdShell @cmd
GO
This is not as difficult as it looks. Build it up a bit at a time. Works amazingly well.
Enjoy
Michael
December 20, 2004 at 1:24 am
See, if this provides additional help:
http://www.microsoft.com/resources/documentation/sql/2000/all/reskit/en-us/part3/c1161.mspx
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply