ODBC ERROR 7410

FIX: You receive error message 7410 when you use a distributed query as a query parameter for the xp_sendmail stored procedure or the sp_makewebtask stored procedure in SQL Server 2000

In Microsoft SQL Server 2000 Service Pack 3 (SP3), when you pass a distributed query to the @query parameter of the xp_sendmail stored procedure or the sp_makewebtask stored procedure, the procedure may fail and you may receive the following error message:

Server: Msg 7410, Level 16, State 1, Line 1
Remote access not allowed for Windows NT user activated by SETUSER.

This problem only occurs when a SQL Server 2000 SP3 instance runs the stored procedures with a distributed query. The version of the linked server is not important.

Note The same distributed queries ran successfully in earlier versions of Microsoft SQL Server 2000.
 

To resolve this problem:
1.obtain the latest service pack for Microsoft SQL Server 2000.

2.Use a global temporary table.
1.>Use a global temporary table for intermediate storage, and then use the global temporary table in the sp_makewebtask stored procedure or in the xp_sendmail stored procedure instead of the linked server. To do this, follow these steps:
select * into ##tmpTable from [<Linked Server Name>].pubs.dbo.authors

2.>Use the global temporary table instead of the linked server query in the @query parameter of the sp_makewebtask stored procedure or the xp_sendmail stored procedure:
EXECUTE sp_makewebtask 'c:/test.htm',
@query = 'select * from ##tmpTable',
@resultstitle ='report title',
@HTMLHeader=3

3.>Drop the global temporary table:
DROP TABLE ##tmpTable

3.Use a flat text file.
Use a flat text file for intermediate storage of the linked server query output. To do this, follow these steps:
1>Store the linked server query output that you want in a flat text file:
EXEC xp_cmdshell 'osql.exe -E -Q"<Linked Server Query>" -oc:/testmail.txt'
2>Use the BCP utility to copy the data from the specified flat text file to a SQL Server table.
3>Use the SQL Server table instead of the linked server in the @query parameter of the sp_makewebtask stored procedure or the xp_sendmail stored procedure:
EXECUTE sp_makewebtask 'c:/test.htm',
@query = 'select * from <SQL Server Table>',
@resultstitle ='report title',
@HTMLHeader=3
Note You may also specify multiple SELECT statements in the @query parameter if multiple SQL Server tables are created in step 2.
4>Drop the SQL Server table that was created in step 2.

Note For the xp_sendmail stored procedure, you can also work around the problem by storing the output of the linked server data in a text file, and then send the output file as an attachment by using the @attachment parameter of the xp_sendmail stored procedure.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值