Solved

textcopy utility for copying image file into sql server table not working in win7

Posted on 2014-04-21
16
663 Views
Last Modified: 2014-06-03
ALTER PROCEDURE [dbo].[usp_textcopy] (
  @srvname     varchar (30),
  @login       varchar (30),
  @password    varchar (30),
  @dbname      varchar (30),
  @tbname      varchar (30),
  @colname     varchar (30),
  @filename    varchar (30),
  @whereclause varchar (40),
  @direction   char(1))
AS
DECLARE @exec_str varchar (255)
SELECT @exec_str =
         'D:\textcopy /S ' + @srvname +
         ' /U ' + @login +
         ' /P ' + @password +
         ' /D ' + @dbname +
         ' /T ' + @tbname +
         ' /C ' + @colname +
         ' /W "' + @whereclause +
         '" /F ' + @filename +
         ' /' + @direction
         
         --print @exec_str
EXEC master..xp_cmdshell @exec_str


is working in win2003 server. but not working in win7 .  trying to copy jpeg file into image col of sql  table.  any reason?
Both jpeg file and textcopy application in d drive
0
Comment
Question by:venkataramanaiahsr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 5
16 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40013058
any error message?
0
 

Author Comment

by:venkataramanaiahsr
ID: 40013157
no. image file does not get copied ,
_________________________________________________________________________
Before  executing the sp

 update dbo.Master_Opd Set Logo = '0x0'
  where rowid=1
 
  select  logo from dbo.Master_Opd
 where rowid=1

O/p

logo
0x307830
________________________________________________________________

After executing the sp
exec usp_textcopy @srvname = 'PC111',
            @login = 'abc',
            @password = 'abc123',
            @dbname = 'DMS',
            @tbname = 'dbo.Master_Opd',
            @colname = 'Logo',
            @filename = 'D:\khlogo.jpg',
            @whereclause = " WHERE rowid = 1 ",
            @direction = 'I'


textcopy application is also in d drive

O/p

output
NULL
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40013175
can you can the tool from the command line, without xp_cmdshell?
is there actually any output from the command?
is D:\ a local drive, a mapped network drive, or a SAN drive?
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40013667
is working in win2003 server. but not working in win7
That would be because you do not have it installed on your Windows 7 box.  TextCopy has been discontinued and was not shipped with SQL Server 2005.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40014132
discontinued, but if you provide the textcopy.exe file, it shall still work
0
 

Author Comment

by:venkataramanaiahsr
ID: 40014707
I think it might be  a service pack issue.   the machine (2003 svr) it worked had sql 2008r2 sp2 installed. I tried in another machine with 2003 svr without sp2. same problem as above.

I installed sql2008r2 sp2 in win7 machine. the installation went through correctly. but I have another problem, I am unable to open new query window  in management studio,

following error comes

could not load file or assembly microsoft.sqlserver.management.multiserverconnection

I removed management studio from add remove programs.  how to reinstall  just the management studie for 2008r2
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40014747
0
 

Author Comment

by:venkataramanaiahsr
ID: 40015806
I installed sql studio again but still the error persists. not able to open new query window.
enclosed herewith error message

pls let me know how to resolve the issue.  this problem is happening after I installed sp2 for sql server 2008r2.
sqlstdudio-error.docx
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40015964
Perhaps you overlooked my previous comment.  There is no TextCopy utility installed with SQL Server 2005 and later.  It no longer exists in those installs.  So unless you have access to a copy of it from SQL Server 2000 you are SOL.
0
 

Author Comment

by:venkataramanaiahsr
ID: 40016012
I have a copy of textcopy utility in the path mentioned in sp
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40016127
I have a copy of textcopy utility in the path mentioned in sp
Have you copied and registered all the supporting dlls such as ntwdblib.dll?
Are you are running on a 32-bit O/S?  If the answer is no,  then you will have to take a different approach.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40016869
and I will also repeat my questions from above:
can you can the tool from the command line, without xp_cmdshell?
is there actually any output from the command?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40017758
I could not agree more.  You need to isolate the problem and the only way to do that is by running the textcopy utility from the command line.  Until you are prepared to do that it is just trial and error.
0
 

Accepted Solution

by:
venkataramanaiahsr earned 0 total points
ID: 40100332
I have used the following method to solve the problem.

UPDATE  Table name SET Logo =
(SELECT * FROM
OPENROWSET(BULK N'D:\logo.jpg', SINGLE_BLOB) AS ORS)
WHERE rowid = 1

Thanks for all your inputs
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40100668
I am glad you found a workaround, I just wish you had responded to our questions, as your answers would have helped other users in the future.
0
 

Author Closing Comment

by:venkataramanaiahsr
ID: 40108047
This solved the problem

UPDATE dbo.Master_Opd
SET Logo =
(SELECT * FROM
OPENROWSET(BULK N'D:\khlogo.jpg', SINGLE_BLOB) AS ORS)
WHERE rowid = 1
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question