Syntax
Replace ('string _ expression1', 'string _ expression2', 'string _ expression3 ')
Parameter description
'String _ expression1'
String expression to be searched. String_expression1 can be character or binary data.
'String _ expression2'
String expression to be searched. String_expression2 can be character or binary data.
'String _ expression3'
String expression used for replacement. String_expression3 can be character or binary data.
The format is as follows:
Update table name set column to be replaced = Replace (the column to be replaced, the character to be replaced, and the character to be replaced)
Example SQL statement:
Update tablename set columename = Replace (columename, 'A', 'B ')
however, it is worth noting that SQL server has a replace function that can be used directly. The replace function of the Access database can only be used in the access environment and cannot be used in Jet SQL, so it is useless to ASP. When this function is called in ASP, an error is prompted: The 'replace 'function in the expression is not defined. You can write a function in ASP to implement this function.
example function: copy Code the code is as follows: function Replace (title)
{< br> Replace (title, 'aaa', 'bbbbb')
return (title)
}< br> BBB = Replace (title)
Update ..... set Title = '"& BBB &"'
reference code for replacing specified characters in ASP + Access in batches: copy Code the code is as follows: <%
set conn = server. createobject ("ADODB. connection ")
Conn. open "provider = Microsoft. jet. oledb.4.0; Data Source = "& server. mappath ("database name. mdb ")
set rs = server. createobject ("ADODB. recordset ")
SQL =" select * from [Table name] "
Rs. open SQL, Conn, 1, 3
while not Rs. EOF
RS ("field name") = Replace (RS ("field name"), "replaced character", "replaced character")
Rs. update
Rs. movenext
Wend
Rs. close
set rs = nothing
Conn. close
set conn = nothing
%>