Question

SQL Server 2008 Image to File (textcopy.exe)

Asked by: Data-Man

Hi 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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-06-30 at 09:49:34ID24533858
Tags

SQL Server 2008

,

Image

,

file

,

textcopy

Topics

SQL Server 2008

,

MS SQL Server

Participating Experts
2
Points
250
Comments
14

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Problem with "textcopy" utility in SQL Server
    I'm using textcopy utility to copy images into SQL Server in my application. I have written an SP for this purpose. It is given below. CREATE PROCEDURE sp_textcopy ( @srvname varchar (30), @login varchar (30), @password varchar (30), @dbname varch...
  2. ADO Stream Causing Broken Images in ASP image loader
    Hello, I'm trying to fix a problem with our image database. IT was working fine untill about a week ago. Now, the new images which are uploaded are Broken! The images that were uploaded BEFORE this error started occuring still load fine, only NEW images show up broken Our...
  3. Problem with ADO Stream SQL Server
    It seems the file is locked when I try to overwrite a file I downloaded from an SQL Server blob with ADO Stream ... is there away to close the file after I download to the file?
  4. Insert image to MSSQL using textcopy
    Ok, I know this question has been asked dozen of time. I did do some research but I encountered some difficulties. Please help me and I promise all the reward points that I have. Below is my procedure : 1) I created a stored procedure with the following source from http://ww...
  5. Textcopy with trusted connection and Windows authenticat…
    Hello, I can successfully put an image into SQL Server using Access and a stored procedure that calls Textcopy when specifying a user name and password. What I would like is to do this without specifying the username and password and having the credentials of the user alrea...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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/forumarchives/SQLServerserver/Jan2006/post26065778.asp

SELECT BlobData.*  
 
FROM OPENROWSET  
 
(BULK ''' + @FileName + ''',  
 
SINGLE_BLOB)

--

more

http://msdn.microsoft.com/en-us/library/ms190312.aspx

 

by: EugeneZPosted on 2009-06-30 at 10:26:29ID: 24747464

 

by: Data-ManPosted on 2009-06-30 at 10:45:10ID: 24747627

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\MSSQL\Binn\textcopy.exe /S /U ' + SYSTEM_USER
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

 

by: EugeneZPosted on 2009-06-30 at 11:10:06ID: 24747838

ok , you did not tell you need them out of DB

Did you try SSIS (like DTS)?

 

by: EugeneZPosted on 2009-06-30 at 11:57:22ID: 24748288

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.microsoft.com/kb/317034

---

Save and Display Images using ASP .NET 2.0 Profile
http://www.dotnet-friends.com/articles/asp/artinasp03e650de-2b15-4fb1-9bdb-aad1a1e5ac5c.aspx
 

 

by: Data-ManPosted on 2009-06-30 at 12:08:01ID: 24748420

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

 

by: EugeneZPosted on 2009-06-30 at 13:42:34ID: 24749369

check my last posted links

 

by: Data-ManPosted on 2009-06-30 at 13:58:54ID: 24749537

I am looking for a solution that runs on the SQL Server Box...preferrably a T-SQL Solution.

Mike



 

by: acperkinsPosted on 2009-07-01 at 18:17:38ID: 24759668

>>preferrably a T-SQL Solution<<
You are out of luck.  There is no T-SQL only solution (and never has been)

 

by: Data-ManPosted on 2009-07-01 at 18:31:03ID: 24759748

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

 

by: acperkinsPosted on 2009-07-02 at 05:54:16ID: 24762712

>>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.

 

by: acperkinsPosted on 2009-07-02 at 05:58:38ID: 24762744

>>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.

 

by: Data-ManPosted on 2009-07-04 at 07:36:09ID: 31599767

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/books?id=i4gg8AqZHMoC&pg=PA159&lpg=PA159&dq=create+%22export+column%22+ssis+package&source=bl&ots=B0hes5TRel&sig=4m2DOxfs4pgzojULZ2Y8ZEGBqqc&hl=en&ei=h2ZPSoXqJ4LwsQPNm_nWBQ&sa=X&oi=book_result&ct=result&resnum=10

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/KB/database/Call_SSIS_from_SP.aspx

Found out that variables within the SSIS are case sensitive.
http://sqlblogcasts.com/blogs/simons/archive/2007/07/23/SSIS---Variable-lists-for-the-script-task-are-case-sensitive.aspx

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::ID].value;"\"' + @strID + '\""

Is not the same as

'/SET \package.variables[User::ID].Value;"\"' + @strID + '\""

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

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...