Sqlserver DTS

 


'**********************************************************************
'  Visual Basic ActiveX Script
'************************************************************************
Private Sub Form_Load()
Main
End Sub
Function Main()
   'On Error Resume Next

'aussql2 overtime
Set Connection = CreateObject("ADODB.Connection")
Connection.open "provider=sqloledb;server=test;database=test;uid=test;pwd=test"
'aussql5 FlowER test
Set Connection1 = CreateObject("ADODB.Connection")
Connection1.open "provider=sqloledb;server=10.5.13.83;database=test;uid=sa;pwd=test$"
strsql = "delete from auoform11_dept  where org_id  not like 'sg%'   "
strsql = strsql & " and org_id not like 'sj%' and  org_id not like 'sq%' and  org_id not like 'sp%' and  org_id not like 'sm01%'  "
Connection1.execute (strsql)

strsql = "select a.org_id,b.org_cname as p1_org_cname,b.org_ename as p1_org_ename,c.org_cname as p2_org_cname,c.org_ename as p2_org_ename  "
strsql = strsql & " from org_data a,org_data b,org_data c  "
strsql = strsql & " where left(a.org_id,2)+'00'=b.org_id and left(a.org_id,3)+'0'=c.org_id  and a.org_id not in('SG10','SG00')  "
strsql = strsql & " and (a.org_id not like 'sg01%'  and a.org_id not like 'sg02%'  and a.org_id not like 'sg03%'and  a.org_id not like 'sm01%'  "
strsql = strsql & " and a.org_id  not like 'sQ01%'  and a.org_id not like 'sQ02%'  and a.org_id not like 'sQ03%' and a.org_id  not like 'sg10%') "

Set rs = Connection.execute(strsql)

While Not rs.EOF

strsql = "SELECT * FROM DEPT where org_id='" & Trim(rs(0)) & "' "
Set rs1 = Connection1.execute(strsql)
If Not rs1.EOF Then
strsql = " update DEPT set p1_org_cname='" & Trim(rs(1)) & "',  p1_org_ename='" & Trim(rs(2)) & "', p2_org_cname='" & Trim(rs(3)) & "', p2_org_ename='" & Trim(rs(4)) & "' where org_id='" & Trim(rs(0)) & "'"
Connection1.execute (strsql)
Else
strsql = "insert into DEPT values('" & Trim(rs(0)) & "','" & Trim(rs(1)) & "','" & Trim(rs(2)) & "','" & Trim(rs(3)) & "','" & Trim(rs(4)) & "')"
Connection1.execute (strsql)
End If
rs.movenext

Wend

 Err = 0
 If Err <> 0 Then
   Main = DTSTaskExecResult_Failure
 Else
   Main = DTSTaskExecResult_Success
 End If
End Function

'**********************************************************************
'  Visual Basic ActiveX Script
'************************************************************************
 
Function Main()
   'On Error Resume Next
 
'ausnetdev
Set Connection = CreateObject("ADODB.Connection")
Connection.Open "provider=sqloledb;server=10.5.13.83;database=a;uid=sa;pwd=$"
 
'aussql5 FlowER test
Set Connection1 = CreateObject("ADODB.Connection")
Connection1.Open "provider=sqloledb;server=10.5.13.83;database=s;uid=sa;pwd=s$"
 
strsql = "select form_no from test where a='a'  and test in('wp','ap')  "
Set rsformno = Connection1.Execute(strsql)
 
While Not rsformno.EOF
 
strsql = "update OAHAOCAI set test_Status ='AP'  WHERE test='" & rsformno(0) & "'"
Connection.Execute (strsql)
 
rsformno.movenext
 
Wend

'**********************************************************************
'  Visual Basic ActiveX Script
'************************************************************************

Function Main()

             Set conn = CreateObject("adodb.connection")
 conn.open  "Provider=SQLOLEDB;server=t;uid=sa;pwd=flower;database=center"

             strsql0= "select emp_no, boss_no from emp_data_manually"

             set rs0=conn.execute(strsql0)
           
             while not rs0.eof

                  strsql1="update emp_data_all set boss_no='" & rs0("boss_no") & "' where emp_no='" & rs0("emp_no") & "'"
                  conn.execute strsql1
                  rs0.movenext

            wend


 Main = DTSTaskExecResult_Success
End Function



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值