Grammar
REPLACE (' String_expression1 ', ' string_expression2 ', ' String_expression3 ')
Parameter description
' String_expression1 '
The string expression to search for. String_expression1 can be either character data or binary data.
' String_expression2 '
The string expression to find. String_expression2 can be either character data or binary data.
' String_expression3 '
The string expression to replace. String_expression3 can be either character data or binary data.
Popular understanding is the format:
Update table Name set the column =replace to replace (the column to replace, the replaced character, the character to replace)
Sample SQL statement:
Update tablename SET columename = REPLACE (Columename, ' A ', ' B ')
However, it is worth noting that SQL Server has the Replace function, which can be used directly, and that the Replace function of an Access database can only be used in an access environment and not in Jet SQL, so it is useless for ASP, Calling this function in ASP prompts an error: the ' REPLACE ' function in the expression is undefined. In ASP, you can write a function to implement this function.
Sample functions:
Copy Code code as follows:
function replace (title)
{
Replace (title, ' aaa ', ' bbbb ')
Return (title)
}
Bbb=replace (title)
Update ... set title= ' &bbb& '
Asp+access Bulk Replace the specified character reference code:
Copy Code code as follows:
<%
Set Conn = Server.CreateObject ("ADODB". Connection ")
Conn.Open" Provider=Microsoft.Jet.OLEDB.4.0;Data source= "& Server.MapPath (" database name. mdb ")
Set R s = Server.CreateObject ("ADODB.") Recordset ")
sql=" Select * from [table name] "
Rs.Open sql,conn,1,3
While not rs.eof
Rs (" field name ") =replace (RS (" word Segment name ")," replaced by character "," character replaced by "
Rs.update
Rs.movenext
Wend
rs.close
Set rs=nothing
Conn.close
Set conn=nothing
%>