I have a big data processing program (tens of millions of data records cannot be processed at the same time)

Source: Internet
Author: User

This program is developed for a very large database and does not use loops.
Purpose:
Batch Replace the content of database fields with tens of thousands of data entries
Code:
<%
'// Database connection
Dim BeeYee_DbName, Connstr, Conn, intSn1
Dim Content, Num, intSn, intIdNo, strCodea, strCodec, Rs, strSql
Server. ScriptTimeOut = 800
BeeYee_DbName = "transfer" 'modify the name of your SQL Server database.
YourServer = "seven" 'modify the address of your SQL Server database here
YourUid = "sa" 'modify your database user name here
YourPassword = "123" 'modify your database password here
Connstr = "Driver = {SQL Server}; Server =" & YourServer & "; Uid =" & YourUid & "; Pwd =" & YourPassword & "; Database =" & BeeYee_DbName
Set Conn = Server. CreateObject ("ADODB. CONNECTION ")
On Error Resume Next
Conn. Open Connstr
If Err <> 0 Then
Err. Clear
Set Conn = Nothing
Response. Write "<div align = center> <br> An error occurred while connecting to the SqlServer database. Check the related settings ...... </Div>"
Response. End
End If
'// Data Processing Section

IntSn = Request ("Sn ")
IntIdNo = Request ("IdNo ")
If intSn = "" Or Not isNumeric (intSn) Then
IntSn = 0
IntSn1 = 0
Else
IntSn = CLng (intSn)
IntSn1 = intSn
End If
If intIdNo = "" Or Not isNumeric (intIdNo) Then
IntIdNo = 0
Else
IntIdNo = CLng (intIdNo)
End If
StrCodea = "/newe" '// You Need to query whether the string is contained.
StrCodeb = "/news" '// Replace the string
StrSql = "Select Top 1 Id, Content, Uptime From News where id>" & intIdNo & "And siteid = 1 order by id"
Set Rs = Server. CreateObject ("adodb. recordset ")
Rs. Open strSql, conn, 1, 3
If not (rs. eof oR rs. bof) then
Content = Rs ("content ")
Num = instr (content, strCodea)
If Num> 0 then
Content = Replace (content, strCodea, strCodeb)
Rs ("Content") = Content
Rs ("Uptime") = now ()
Rs. Update
IntSn = intSn + 1
End If
IntIdNo = Rs ("Id ")
Rs. Close
Set Rs = Nothing
Response. write ("<br> <Div align = center> converting <font color = red>" & intSn & "</font> News .. .. </Div> ")
If intSn = intSn1 Then Response. write ("<br> <Div align = center> there is no conversion in the news, and the program continues to convert the next article </Div> ")
Response. write ("<meta http-equiv =" "refresh" "content =" "0; url =? Sn = "& intSn &" & IdNo = "& intIdNo &" "> ")
Else
Response. write ("<br> <Div align = center> Switch complete !! <Font color = red> "& intSn &" </font> News. </Div> ")
Rs. Close
Set Rs = Nothing
Response. End ()
End If

%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.