Ask a Question related to Microsoft SQL / MS SQL Server, Design and Development.
-
anamika #1
BCP query out executed by xp_cmdshell works fine from query analyzer but fails from VB Component
Hi all,
I have a stored procedure which returns a vast number of record and i
have to write the output into a csv file. I'm using BCP utility to do
this and BCP utility is executed by xp_cmdshell from inside another
stored procedure.
Everything works fine from developement server but when the code was
deployed at client end on live server the code is not being executed
from component though on live server from SQL query analyzer it works
fine but from component it fails.
What could be the reason behind
My code is
CREATE PROCEDURE ParishPay_GenerateSouthDataCSV
(
@return_value int output,
@School_id int,
@session varchar(50),
@filename varchar(100)
)
AS
DECLARE @bcpCommand varchar(2000)
DECLARE @Arguments varchar(50)
DECLARE @result int
SET @Arguments = @School_id
SET @Arguments = @Arguments + ','''
SET @Arguments = @Arguments + @session + ''
SET @bcpCommand = '" bcp "exec DTMSv3MG.dbo.SouthDataPaymentCouponCSV
'
SET @bcpCommand = @bcpCommand + @Arguments + ''' " queryout "'
SET @bcpCommand = @bcpCommand + @FileName + '" -U Username -P password
-S Server -c -T -t "," "'
select @bcpCommand
EXECUTE @return_value = master..xp_cmdshell @bcpCommand
SELECT @return_value as return_value
GO
I don't think there is any problem in the code as it works fine on
developement server. Even no error is logged it the sp fails then
error should be logged but what i doubt either BCP fails orelse
xp_cmdshell is not being executed in live server from component.
Please suggest me a solution. Is it a problem with permission??
Thanks
anamika Guest
-
CFSTOREDPROC to Oracle on Linux fails - same query onWin2003 works
Hi folks I hope you can help me. I'm having a terrible time trying to get a query to work. I've got a CF MX6.1 Standard system talking to an... -
Query works in fine CF5 but not CFMX
I have a simple query against an Oracle database that works in CF 5 but not in CFMX. In CF 5 I get one record which is what I want, but in CFMX I... -
'Text' data type returned differently between ASP & Query Analyzer
I have the SQL 2000 server with a database table having one 'text' data type column. This column stores the general text message (normally body of... -
sql statement works in query analyzer but not in asp/ado?
I am new to asp/ado (well and sql server)... this has been driving me mad for hours now. I have created an SQL statment using access query design. I... -
Generate Table script from query analyzer...
You can use SQL-DMO to do that but not straight tsql. -- Andrew J. Kelly SQL Server MVP "Robert Taylor" <robertt@rtnetworks.com> wrote... -
Gary X #2
Re: BCP query out executed by xp_cmdshell works fine from query analyzer but fails from VB Component
Try to catch the error message. Most likely it's security related. Does the
user have rights to run xp_CMDShell?
Gary
"anamika" <anamikas@mindfiresolutions.com> wrote in message
news:d9c65892.0307012216.4e6e902f@posting.google.c om...> Hi all,
>
> I have a stored procedure which returns a vast number of record and i
> have to write the output into a csv file. I'm using BCP utility to do
> this and BCP utility is executed by xp_cmdshell from inside another
> stored procedure.
>
> Everything works fine from developement server but when the code was
> deployed at client end on live server the code is not being executed
> from component though on live server from SQL query analyzer it works
> fine but from component it fails.
>
> What could be the reason behind
>
> My code is
>
> CREATE PROCEDURE ParishPay_GenerateSouthDataCSV
> (
> @return_value int output,
> @School_id int,
> @session varchar(50),
> @filename varchar(100)
> )
> AS
>
> DECLARE @bcpCommand varchar(2000)
> DECLARE @Arguments varchar(50)
> DECLARE @result int
>
> SET @Arguments = @School_id
> SET @Arguments = @Arguments + ','''
> SET @Arguments = @Arguments + @session + ''
>
> SET @bcpCommand = '" bcp "exec DTMSv3MG.dbo.SouthDataPaymentCouponCSV
> '
> SET @bcpCommand = @bcpCommand + @Arguments + ''' " queryout "'
> SET @bcpCommand = @bcpCommand + @FileName + '" -U Username -P password
> -S Server -c -T -t "," "'
>
>
> select @bcpCommand
>
> EXECUTE @return_value = master..xp_cmdshell @bcpCommand
>
> SELECT @return_value as return_value
>
> GO
>
> I don't think there is any problem in the code as it works fine on
> developement server. Even no error is logged it the sp fails then
> error should be logged but what i doubt either BCP fails orelse
> xp_cmdshell is not being executed in live server from component.
>
> Please suggest me a solution. Is it a problem with permission??
>
> Thanks
Gary X Guest



Reply With Quote

