Solved

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

Posted on 2014-04-21
16
659 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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