December 21, 2005 at 12:23 pm
I'm having issues using bcp through xp_cmdshell in Query Analyzer on a SQL 2000 64 bit machine. When ran in Query Analyzer I get an error that the objects called in a select statement are invalid.
Weird thing is, I can run a DTS using an Execute Process Task that calls the bcp tool and runs the same query and exports to a file.
Anyone have this similar type issue?
December 21, 2005 at 1:51 pm
You ought to post your actual syntax when asking a question like this.
From what little you've provided, I'm going to guess it has to do with quoted identifier being set on for your session and you're using double quotes?
December 22, 2005 at 6:36 am
Okay, here it is. Again, if I run this from one of our 32 bit machines using a copy of the same db it works fine. But on the 64 bit machine it returns an error saying the objects in the select query are invalid:
declare
@buf varchar(400),
@exe varchar(30),
@bcppath varchar(250),
@connectbuf varchar(50),
@user varchar(30),
@pass varchar(30),
@res int
select @exe = value
from conf_var
where name = 'bcpexe'
set @bcppath = '\\server\mserv\file\test\mserv0.msv'
select @user = value
from conf_var
where name = 'bcpuser'
select @user '@user'
if upper(@user) = 'TRUSTED'
select @connectbuf = ' -T -c'
else
select @connectbuf = ' -U' + @user + ' -P' + @pass + ' -c'
select @connectbuf '@connectbuf'
select @buf = @exe + ' "select line80 from ' + db_name() + '..rec_output p, ' + db_name() + '..record_order o where upper(p.style_ind) = upper(o.rec) order by p.loan_no_alpha, o.ord" queryout ' + @bcppath + @connectbuf
select @buf '@buf'
exec @res = master..xp_cmdshell @buf--, NO_OUTPUT
select @res '@res'
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply