Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Error = [Microsoft][SQL Native Client]Unable to re

Author  Topic 

Balajisoliver
Starting Member

1 Post

Posted - 2010-06-09 : 00:34:21
Hi People,
Am getting this error when i try to run my SP which insertes data from my table into the text file.
But to your surprise these error didnt happen to me on another machine .

Here is the SP i have used.


Alter procedure sp_AOStextgeneration
as
begin


set nocount on
declare @sql as varchar(8000)

declare @docid as varchar(max)
select @docid=newid()

declare @count as int
declare @lastupdate datetime


select @lastupdate=isnull(max(Dateofdelivery),CONVERT(datetime,'1900-01-01')) from ProductCart.dbo.tbl_sapsettings where active=1

set @count= (select COUNT(*) from ProductCart.dbo.[v_AOS-SAP] where datediff(mi,ProductCart.dbo.[v_AOS-SAP].InvoiceDate,@lastupdate)<= 0)
print @count
if @count>0
begin
select @sql = 'bcp "exec ProductCart.dbo.X_sp_generateAOStoSAP_h_data ''' + @docid + '''" queryout E:\Interfaces\AOS-SAP\' + @docid + '_d.txt -c -t, -T -S '+ @@servername


exec master..xp_cmdshell @sql
--print @sql

--select @sql = 'bcp "exec pc_bak.dbo.X_sp_generateAOStoSAP_h_data ''' + @docid + '''" queryout E:\Interfaces\AOS-SAP\' + @docid + '_d.txt -c -t, -T -S ' + @@servername
--exec pc_bak..xp_cmdshell @sql
----print @sql


if @@ERROR =0
begin
select @sql='Insert into ProductCart.dbo.tbl_sapsettings(Dateofdelivery, FileName,Active) values (getdate(),''' + @docid + '.dat'',1)'
exec(@sql)
end
end
else
begin
print 'Zero Rows Copied'
end

end



Pls do help me as i really find hard to figure out the reason behind this mysterious error.
Thanks
Regards
N.Balaji

   

- Advertisement -