Solved

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

Posted on 2014-04-21
16
651 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
  • 6
  • 5
  • 5
16 Comments
 
LVL 142

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 142

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

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 142

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 142

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now