SQL intercepts a string and replaces it. Use sqlreplaceREPLACE to replace all the second given string expressions in the first string expression with the third expression.
SQL intercepts a string and replaces it. Use SQL replace REPLACE to replace all the second given string expressions in the first string expression with the third expression.
SQL statement to intercept string functions
SQL intercepts a string and replaces it.
Use SQL replace
Replace
Replace all the second given string expressions in the first string expression with the third expression.
Syntax
Replace (''string _ replace1 '', ''string _ replace2'', ''string _ replace3 '')
Parameters
''String _ replace1''
String expression to be searched. String_replace1 can be character data or binary data.
''String _ replace2''
String expression to be searched. String_replace2 can be character data or binary data.
''String _ replace3''
String expression used for replacement. String_replace3 can be character data or binary data.
Return type
If string_replace (1, 2, or 3) is one of the supported character data types, character data is returned. If string_replace (1, 2, or 3) is one of the supported binary data types, binary data is returned.
Declare @ str varchar (1000 );
Set @ str = '/paperdb/paperskinfile/default. skin ';
Select
Left (right (@ str, charindex ('/', reverse (@ str)-1), charindex ('. ', right (@ str, charindex ('/', reverse (@ str)-1)-1)
Method 2
Declare @ SQL varchar (100)
Set @ SQL = '/paperdb/paperskinfile/default. skin'
Select stuff (right (@ SQL, len (@ SQL)-charindex ('/', @ SQL), len (right (@ SQL, len (@ SQL) -charindex ('/', @ SQL)-(charindex ('/', right (@ SQL, len (@ SQL)-charindex ('/', @ SQL), 1, charindex ('/', right (@ SQL, len (@ SQL)-charindex ('/', @ SQL )), len (right (@ SQL, len (@ SQL)-charindex ('/', @ SQL)-(charindex ('/', right (@ SQL, len (@ SQL)-charindex ('/', @ SQL )))))),'')
Zookeeper ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Default. skin