?
Solved

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

Posted on 2014-04-21
16
Medium Priority
?
684 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

762 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