首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

一个关于连接服务器的有关问题

2012-03-12 
一个关于连接服务器的问题我程序中有一个存储过程,在程序中调用和查询分析器中调用都没有问题,我想把它放

一个关于连接服务器的问题
我程序中有一个存储过程,在程序中调用和查询分析器中调用都没有问题,我想把它放到代理的任务中自动调用,就不能成功,就是因为程序中有连接服务器的代码,( CREATE proc p_i_emp  
  
as  
begin  
  insert into jy.lis3000.dbo.t_emp (em_ctjbm, em_ctjxm, em_ctjxb, em_dcsny,em_iage)  
  
  
  select substring(em_vidcard,1,8), substring(em_vname,1,3),substring(em_vsex,1,2),null,  
  case when len(em_vidcard1)=15 then datepart(year,getdate())- substring(em_vidcard1,7,2) - 1900  
  when substring(em_vidcard1,7,8)='00000000' then null  
  when substring(em_vidcard1,7,8)='' then null  
  when substring(em_vidcard1,7,8) is null then null  
  when datepart(year,getdate()) - substring(em_vidcard1,7,4)<15 then null  
  else datepart(year,getdate()) - substring(em_vidcard1,7,4) end em_inl  
  from t_employee where em_vidcard not in(select em_ctjbm from jy.lis3000.dbo.t_emp)  
  and em_vname<>'' and em_vname<>'无'  
  
  
end  
  
)头都大了,帮帮我,兄弟姐妹们

[解决办法]

SQL code
CREATE proc p_i_emp as set nocount onbegin insert into jy.lis3000.dbo.t_emp (em_ctjbm, em_ctjxm, em_ctjxb, em_dcsny,em_iage) select substring(em_vidcard,1,8), substring(em_vname,1,3),substring(em_vsex,1,2),null, case when len(em_vidcard1)=15 then datepart(year,getdate())- substring(em_vidcard1,7,2) - 1900 when substring(em_vidcard1,7,8)='00000000' then null when substring(em_vidcard1,7,8)='' then null when substring(em_vidcard1,7,8) is null then null when datepart(year,getdate()) - substring(em_vidcard1,7,4)<15 then null else datepart(year,getdate()) - substring(em_vidcard1,7,4) end em_inl from t_employee where em_vidcard not in(select em_ctjbm from jy.lis3000.dbo.t_emp) and em_vname<>'' and em_vname<>'无' end
[解决办法]
uping

热点排行