By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,929 Members | 631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,929 IT Pros & Developers. It's quick & easy.

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

P: n/a
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 dh******@freewavetech.dom asap.

thnx,

dharmesh
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Dharmesh Gandhi" <dh******@freewavetech.com> wrote in message
news:1d*************************@posting.google.co m...
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 dh******@freewavetech.dom asap.

thnx,

dharmesh


The 'incorrect syntax' message suggests that one of your command strings is
not being constructed correctly. For troubleshooting, it might be useful to
create a @Debug parameter, then add this to your procedure:

....
if @Debug = 1
print @cmd
exec Master..xp_cmdShell @cmd

That way you can see exactly what the command being executed is, and that
may help to find the syntax error.

Simon
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.