REPLACE
Replaces all occurrences of the second given string expression in the first string expression with the third expression.
Grammar
REPLACE (' String_replace1 ', ' string_replace2 ', ' string_replace3 ')
Parameters
"' String_replace1 '"
function | string T-SQL is less capable of handling strings, such as I'm looping through strings like 1,2,3,4,5, and if you use arrays, traversal is simple, but T-SQL does not support arrays, so it's tricky to handle. The function below implements
function/*-------------------
--function to realize split function
--zz 2007/04/01
--Return only the last string
*/
Alter function F_split(@SourceSql varchar (8000),--string@StrSeprate varchar (10)--Separator)Returns varchar (1000)AsBeginDECLARE @i
server|sqlserver| function
A function similar to split was written in SQL Server this morning, as required by query statistics, as follows
Create function F_split (@SourceSql varchar (8000), @StrSeprate varchar) returns @temp table (a varchar (100)
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Create
Function
DBO. splitstring(
@ Expression
Nvarchar
(
4000
),
--
String to be split
@ Delimiter
ArticleDirectory
Group aggregation using grouping
Online help from SQL Server
Use adventureworks; goselect salesquota, sum (salesytd) 'totalsalesytd ', grouping (salesquota) as 'grouping' from sales. salespersongroup by salesquota
Replace "BackEnd_Clean" with "'backend" in the url field in the Mng_Auth_SiteMap table, and keep the rest unchanged, as shown below:
UPDATE [BackEnd_DB]. [dbo]. [Mng_Auth_SiteMap]SET [URL] = replace (cast ([url] as nvarchar (255), 'backend _ clean',
Template:
[Ownername] [ownertitle], hello! I'm a [projectname] Insurance Company clerk [username], your [quotecontent]. If you are not clear, contact the service hotline: (PublicCompany [projectcontactphone]) or (personal [usermobilephone]).
Instr (STR, CHR) --- location where CHR appears 1st times in StrInstr (STR, CHR, 3rd) --- searches for the position where the CHR appears 2nd times in STR starting from the STR character positionInstr (STR, CHR,-3, 2) --- searches for the position
A large amount of data has been collected on a site, and about 100,000 of the data has been collected on a site in the same industry. Of course, the title has not been changed, or the original title. This is to facilitate the filtering of duplicate
SQL Server Chinese version of the default Date field datetime format is YYYY-MM-DD Thh:mm:ss.mmm
For example:
Select GETDATE ()
Sorted out the date format conversion methods that you might often use in SQL Server:
examples are as follows:
Select
File:. wmv; Size: 19,535kb; Length: 00:26:39.
Download Address: Sqlfunction_udf_week.rar
The following is updated on 20120105:
2012 just arrived, the software developed uses this function to discover bugs. The first week of 2012 should be 2012-01-01
Returns the number of rows affected by the previous statement. If the number of rows is greater than 2 billion, use Rowcount_big.Grammar@ @ROWCOUNTreturn typeIntNotesTransact-SQL statements can set the value of the @ @ROWCOUNT in the following
One, using a temporary table as an array
Copy Code code as follows:
Create function F_split (@c varchar), @split varchar (2))
Returns @t table (col varchar (20))
As
Begin
while (CHARINDEX (@split, @c) <>0)
Begin
Copy Code code as follows:
SET ANSI_NULLS on
Go
SET QUOTED_IDENTIFIER ON
Go
/*
by Kudychen 2011-9-28
*/
CREATE function [dbo]. [Splitstring]
(
@Input nvarchar (max),--input string to is separated
@Separator nvarchar (max) = ', ',--a
Function
Once encountered such a situation, in the Database meeting table has publishtime (datetime,8) field, used to store a session, in the deposit due to specify the time of the meeting, the format is Yyyy-mm-dd Hh:mm:ss, And we query it through
You will encounter tasks such as SQL Server mock data Generation and random padding of numeric column values (such as Integer, date, and time data types), all of which use random numbers. For this reason, this article will briefly summarize the use
server| function
Identity (Identity) column, and many people call it the self-add column, in SQL Server 2000, the identity column is defined by identity, and here is an example of a function related to getting the identity value of the last inserted
How to use convert:
////////////////////////////////////////////////////////////////////////////////// //////
Format:
CONVERT (Data_type,expression[,style])
Description
This style is generally in the type of time (datetime,smalldatetime) and
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.