Solved

DB-Library Error 10007: General SQL Server error: Check messages from the SQL

Posted on 2003-11-04
3
4,251 Views
Last Modified: 2007-12-19
DB-Library Error 10007: General SQL Server error: Check messages from the SQL
      Server.                                                                




CREATE PROCEDURE [dbo].[spu_Import_Export_Image]
(
@srvr             varchar(50),
@db             varchar(50),
@usr             varchar(15),
@pwd             varchar(50),
@tbl             varchar(50),
@col             varchar(50),
@mod             varchar(1),
@imgpath1      varchar(1000),
@pk             varchar(50)
)

AS

BEGIN

declare @path            varchar(50)
declare @whr             varchar(200)
declare @fil             varchar(100)
declare @cmd            varchar(1000)
declare @imgpath       varchar(800)
declare @ext             varchar(5)
--declare @pk             varchar(50)
declare @KeyValue       varchar(8000)
declare @image       varchar(50)
--declare @imgpath1      varchar(1000)
declare @imgpath2      varchar(1000)
declare @sellist             varchar(2000)

set @path      = 'c:\textCopy.exe'


select @sellist = 'DECLARE curKey CURSOR FOR SELECT ' + @pk +' FROM  ' + @tbl + '  ORDER BY ' + @pk

exec (@sellist)

OPEN curKey
FETCH NEXT FROM curKey INTO @KeyValue

WHILE (@@fetch_status = 0)
  BEGIN
      set @whr      = '"where '+ @pk +' = "' + @KeyValue
      set @fil      = @imgpath1 + '\' + @KeyValue --+ @ext
      set @cmd = @path + ' /S ' + @srvr + ' /D ' + @db + ' /U ' + @usr +  ' /P ' + @pwd+ ' /T ' + @tbl + ' /C ' +  @col + ' /W ' + @whr +  ' /F ' + @fil+ ' /' + @mod
      exec Master..xp_cmdShell @cmd
      FETCH NEXT FROM curKey INTO @KeyValue
  END


CLOSE curKey
DEALLOCATE curKey

END

GO


Above srcipt runs fine with image data type in one table but when i run for some other table it gives me Error Message


TEXTCOPY Version 1.0                                                          
 DB-Library version 8.00.194                                                  
 SQL Server 'WSQL01' Message 170: Line 1: Incorrect syntax near '99'. (Concern
      ing line 1)                                                            
 DB-Library Error 10007: General SQL Server error: Check messages from the SQL
      Server.                                                                
 ERROR: Could not use database 'test1'                                      
                                   
 NULL                                                                          
-----------

Aslo it only runs on server console if i run it from workstation uing same files and tables it gives me an error again. Can anybody help me and reply me at dharmesh@freewavetech.dom asap.

thnx,

dharmesh
                                                                            
                                                                            
                                          
0
Comment
Question by:Dharmeshgandhi
3 Comments
 
LVL 6

Accepted Solution

by:
lausz earned 20 total points
Comment Utility
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

772 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

14 Experts available now in Live!

Get 1:1 Help Now