Main Topics
Browse All TopicsHi everyone,
I currently have a SQL Server 2000 database and we are storing small graphics in the database. No problem getting them in, we use an ADO stream. Very fast!! No worries there. We use TextCopy.exe to move the images to a file and then email. No worries there either.
Now I'm working on a SQL Server 2008 database and I can stream the images to the database all day long, but I can't find the TextCopy command anywhere in the install. Did they remove it from 2008? Is there a better way to take am graphic from an image field and put it to file?
I've been searching the web and EE and seem to be hitting a dead end. Can someone please point me in the right direction?
Thanks,
Mike
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Eugene,
I appreciate all the links, but I've seen them before. Here is what I used to have in 2000.
SELECT @strExec = 'C:\Progra~1\Micros~1\MSSQ
SELECT @strExec = @strExec + ' /P ' + @strPW + ' /D Balance_StRegis_NYC /T tblApplicationComments /C ScreenImage '
SELECT @strExec = @strExec + '/W "WHERE ApplicationCommentID=' + @strID + '" /F ' + @strLocalFileName + ' /O'
EXEC master..xp_cmdshell @strExec
This little snippet of code would take one image from a single record and write it to a file. All the links you are showing me take me down a different path. I do not program in any version of C.
I have to believe that there is a simple way via T-SQL to take the data in an image field and put it to a file in SQL Server 2008.
I can't be the only person in the world trying to do this.
Thanks,
Mike
please check
HOW TO: Read and Write a File to and from a BLOB Column by Using Chunking in ADO.NET and Visual Basic .NET
http://support.microso
---
Save and Display Images using ASP .NET 2.0 Profile
http://www.dotnet-f
Please reread my original post.
It says that I don't have any problems putting the graphics in the SQL Server database.
The question I asked was.....Is there a better way to take a graphic from an image field and put it to file?
I do not want to stream the image back to the client and do something with it there. I need to put the image to a local file on the server (which is why I was using TextCopy). Once it's local then I can use dbmail to send an email with the graphic as an attachment.
Hope this helps
Thanks,
Mike
acperkins,
It's been a couple of years, but I think you've answered a question or two of mine in the past and I'm sure I've used a solution or two that you have posted. :-)
TextCopy worked great. Used it for years. The command was executed in a command shell, but was still accomplished by executing a proc.
There isn't a workaround in 2008 for the removal of the textcopy command?
Is there another solution to populating the attachment with a graphic contained within the image data type without sending it down to the client?
I have to believe that there has to be a way to take the data in an image field and write it to a file (at the server).
Thanks,
Mike
>>TextCopy worked great. <<
I know exactly what is TextCopy, it is a utility built for exactly the purpose you need and I have actually used it about 10 years ago. But it is not T-SQL.
>>The command was executed in a command shell, but was still accomplished by executing a proc. <<
So does Notepad. That does not qualify it as T-SQL.
>>There isn't a workaround in 2008 for the removal of the textcopy command?<<
Did you not see the comment http:a24747424 ?
>>Is there another solution to populating the attachment with a graphic contained within the image data type without sending it down to the client?<<
Not without writing an app to do it and install on the server.
>>I have to believe that there has to be a way to take the data in an image field and write it to a file (at the server).<<
See above.
>>I can't be the only person in the world trying to do this.<<
In general it is not considered good practice to store images in the database, that is why there has never been much demand for it. Having said that, MS SQL Server has introduced a new attribute called FILESTREAM that makes the process somewhat more palatable.
>>It's been a couple of years, but I think you've answered a question or two of mine in the past and I'm sure I've used a solution or two that you have posted. <<
And if you look carefully you will actually find VB6 solutions using ADO that I have posted for reading and writing image data to the database. I realize this is not what you need and instead are looking for an ellusive T-SQL solution, however I mention this so that you are aware that I know exactly what you are after.
I was looking for a work around solution that could be run via a stored procedure. After a day of searching, building and testing I was able to create a working solution. The final solution use the stored procedure xp_cmdShell to execute an SSIS package, but it does not employ the TextCopy command. And a xp_cmdShell is still available in SQL Server 2008 the solution is viable.
After clicking on the SSIS link to Microsoft and seeing the Export Column Transformation capabilities, it pointed me in the right direction. I scoured the web for examples and found one that really helped.
How to create an Export Column Transformation SSIS package
http://books.google.com/bo
The above link was probably the most helpful, but also required a lot of other research. I have never created an SSIS package before so there were a number of steps that required multiple Google searches to determine how to accomplish said step.
How to execute an SSIS package with variables via T-SQL.
http://www.codeproject.com
Found out that variables within the SSIS are case sensitive.
http://sqlblogcasts.com/bl
I normally dont worry whether or not my not my variables are case sensitive. Since I follow strict naming conventions, my variables are always referenced the same as they are declared.
And finally with a couple of hours of trouble shooting I found out that not only the variables must be case sensitive, but so is the word Value, it must start with an upper case V. Which is interesting because it makes no difference if the word SET is upper or lower, it still works.
'/SET \package.variables[User::I
Is not the same as
'/SET \package.variables[User::I
Notice the second one has an upper case V for value. It will NOT work with a lower case v.
If you are looking for a workaround to the TextCopy command to move a file from your database to a local file, the above links should help you create a solution.
Happy coding!!
Mike
Business Accounts
Answer for Membership
by: EugeneZPosted on 2009-06-30 at 10:22:18ID: 24747424
TextCopy.exe is gone in sql 2005-2008
-----
however you can try to use textcopy.exe in SQL 2008:
copy it to sql server 2008 from 2000 and try to run it e.g. from xp_cmdshell
--
also
try solution from
http://www.eggheadcafe .com/forum archives/S QLServerse rver/ Jan20 06/post260 65778.asp
SELECT BlobData.*
FROM OPENROWSET
(BULK ''' + @FileName + ''',
SINGLE_BLOB)
--
more
http://msdn.microsoft. com/en-us/ library/ms 190312.asp x