[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 729
  • Last Modified:

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

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
venkataramanaiahsr
Asked:
venkataramanaiahsr
  • 6
  • 5
  • 5
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
any error message?
0
 
venkataramanaiahsrAuthor Commented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
Anthony PerkinsCommented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
discontinued, but if you provide the textcopy.exe file, it shall still work
0
 
venkataramanaiahsrAuthor Commented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0
 
venkataramanaiahsrAuthor Commented:
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
 
Anthony PerkinsCommented:
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
 
venkataramanaiahsrAuthor Commented:
I have a copy of textcopy utility in the path mentioned in sp
0
 
Anthony PerkinsCommented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
Anthony PerkinsCommented:
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
 
venkataramanaiahsrAuthor Commented:
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
 
Anthony PerkinsCommented:
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
 
venkataramanaiahsrAuthor Commented:
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

  • 6
  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now