Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-11-04
3
Medium Priority
?
4,813 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
1 Comment
 
LVL 6

Accepted Solution

by:
lausz earned 80 total points
ID: 9678141
0

Featured Post

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.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

824 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