create PROCEDURE [dbo].[sp_GetstatemonthSP]
(
@zzjgdm varchar(255),
@tablesname varchar(255) -- 表名应为 statemonth
)
AS
begin
-- Exec sp_droplinkedsrvlogin statdata_server,Null
-- Exec sp_dropserver statdata_server
-- EXEC sp_addlinkedserver
-- @server='statdata_server',--被访问的服务器别名
-- @srvproduct='',
-- @provider='statdata_server',
-- @datasrc='203.175.145.174' --要访问的服务器
-- exec sp_serveroption 'statdata_server','rpc out','true'
-- exec sp_serveroption 'statdata_server','rpc','true'
-- EXEC sp_addlinkedsrvlogin
-- 'statdata_server', --被访问的服务器别名
-- 'false',
-- NULL,
-- 'stat', --帐号
-- '687459219' --密码
-- declare @sql varchar(1000)
-- declare @TempCode varchar(255)
-- --set @TempCode=(select top 1 hgdm from qyjbb where zzjgdm=@zzjgdm)
-- set @TempCode = dbo.FuncFromJgdmToHgdm(@zzjgdm)
-- print @TempCode
-- if @TempCode=null or @TempCode=''
-- begin
-- set @TempCode='0000000000'
-- end
----print @TempConnstring
-- --set @sql = 'select * from openquery([203.175.145.174],''SET FMTONLY OFF;set nocount on;exec statdata.dbo.SingleCorpIEDataMonth ' + @TempCode + ''') as statemonth for xml auto'
-- set @sql = 'select * from openquery(statdata,''SET FMTONLY OFF;set nocount on;exec statdata.dbo.SingleCorpIEDataMonth ' + @TempCode + ''') as statemonth '
-- print @sql
-- exec(@sql)
--end