35. use SQL query analyzer and SQL profilerUse SQL query AnalyzerUse SQL profilerOptimize T-SQL statementSummaryIn this chapter, we will continue with the description of the pre-stored procedures in Chapter 21st. This chapter describes how to use
: Select Replace ('abcdef', 'bcd', 'ijklmn ') value from dual
26. replace all substringsS: replaceO: Select translate ('fasdbfasegas', 'fa ', 'my') value from dual
27. LengthS: Len, datalengthO: Length
28. case-insensitive lower, upper
29. uppercase lettersS: NoO: Select initcap ('abcd DSAF df') value from dual
30. Left fill space (the first parameter of lpad is space, which is the same as the space function)S: Select space (10) + 'abc' ValueO: Select lpad ('abc', 14) value from dual
31. Right f
: Len, datalengthO: Length28. case-insensitive lower, upper29. uppercase lettersS: NoO: Select initcap ('abcd DSAF df') value from dual30. Left fill space (the first parameter of lpad is space, which is the same as the space function)S: Select space (10) + 'abc' ValueO: Select lpad ('abc', 14) value from dual31. Right fill space (the first parameter of rpad is space, which is the same as the space function)S: Select 'abc' + space (10) ValueO: Select rpad ('abcd', 14) value from dual32. Delete Sp
spaces can be done using the SQL RTrim () functionP.S Why I did not add RTrim and no space, and the book is not the same ~L Use aliasesA column alias is an alternate name for a field or valueL Perform arithmetic calculationsSelect Calculation formula as alias from table where conditionSeven Using functionsL Text Processing functionUPPER () converts text to uppercaseSelect column, Upper (column) as Alias from table order by columnCommon Text Processin
13. T-SQL and SQL query AnalyzerWhat is SQL?What is T-SQL?Introduce new features of T-SQLHow to Use T-SQLSummaryIn this chapter, we will introduce some basic concepts about the Structured Query Language What is SQL? SQL is a datab
Sqlserver Management
Common field types: Bit (optional values: 0, 1), datetime, Int, varchar, and nvarchar (may contain nvarchar for Chinese)
Differences between varchar, nvarchar, and char (N): Fill in spaces for less than N parts of char (n. VaR: Variable, variable.
SQL statements
Use strings in SQL statementsSingle quotes.
SQL
: DATALENGTH (expression) return value: If the expression data type is varchar (max), nvarchar (max), or varbinary (max) data type, the bigint is returned, otherwise int is returned. Example: Select Datalength (' I am a pawn ') --Output
of the ten Select Len (' I am a soldier ') --Output 5
Select datalength (' ABCDE ') --Output 5
Select Len (' ABCDE ') --Output 5 22, SOUNDEX Returns a four-character code (
---- Set a non-primary key to clustered index [Step 4] to: http://king123654789.iteye.com/blog/1169191
1. View All indexes. Clustered indexes are created on the primary key by default.Sp_helpindex person
2. -- delete the primary key constraint and remove the index constraint on the primary key queried in [1], for example, PK _ person _ 117F9D94. Remove the primary key constraint from the primary key field. This field is not the primary key.Alter table person drop constraint PK _ person _ 117F9
expressionUNICODE (a string that needs to return the first character integer value)' need to return First character The integer value of the string ' is an nchar or nvarchar expression. Example:SELECT UNICODE (' small ')Returns: 23567SELECT UNICODE (' small porter ')Returns: 2356713.Pronunciation Matching degreeSOUNDEX () is used to calculate the pronounced characteristics of a string,Returns a four-character string,And the first character of the return value is always the first character in
and return a single value.(Iii) scalar function: a scalar function is used to process and compute one or more parameter values passed to it and return a single value.
The most common functions in SQL Server
String FunctionsString functions can perform different operations on binary data, strings, and expressions. Most string functions can only be used for char and varchar data types and explicitly converted to char and varchar data types, A few strin
(' abcdef ', ' {} ')--delimiter is}--{ABCDEF}Pronunciation Matching degreeSometimes we don't know the spelling of a person's name, but we know his pronunciation, and then we can make a matching test of the pronunciation.Soundex () is used to calculate the pronounced characteristics of a string, which is a four-character string, the first character of the feature is always the first character in the initial string, and then a three-digit numeric value.Select Sname,
Unicode string with delimiters, in which the input string becomes a valid SQL Server delimited identifier.QuoteName('character_string') character_string must not exceed -a character. More than -Characters of the input will returnNULL. Select QuoteName('Abc[aa]def') The result is:[abc[]]DEF] Please note that the string ABC[]the right bracket in def has two, which indicates the escape character. Select QUOTENAME('abcdef'," '")--delimiter is two single
. substr (string, start, count)Substring, starting from start, countSQL> select substr ('123', 13088888888) from dual;
Substr ('--------08888888
12. Replace ('string', 's1', 's2 ')String: the character or variable to be replaced.String to be replaced by S1String to be replaced by S2SQL> select Replace ('He love you', 'hes', 'I') from dual;
Replace ('heloveyou', 'hes', 'I ')------------------------------I love you
13. soundexReturns a string with the same pronunciation as a given string.SQL> Crea
Artificial Intelligence automatic SQL optimization tools-SQLTuning for SQL Server, SQL-sqltuning
In response to this situation, the artificial intelligence automatic SQL optimization tool came into being. Now I will introduce this tool: SQLTuning for SQL Server.
1.
First of all, the so-called SQL dynamic and static, refers to when SQL statements are compiled and executed, both are used in SQL embedded programming, which is referred to as embedded refers to the SQL statement embedded in the high-level language, rather than the type of microcontroller embedded programming.In a high
1: replace FunctionThe first parameter is your string, the second parameter is what you want to replace, and the third parameter is what you want to replaceSelect Replace ('lihan', 'A', 'B ')-----------------------------Lihbn
(The number of affected rows is 1)========================================================== ========================2: substring function (in SQL Server 2005)The first parameter is your string, the second parameter is the start
Comparison of common functions of SQL Server and Oracle
--------- Mathematical functions1. Absolute ValueS: select abs (-1) valueO: select abs (-1) value from dual2. INTEGER (large)S: select ceiling (-1.001) valueO: select ceil (-1.001) value from dual3. Round (small)S: select floor (-1.001) valueO: select floor (-1.001) value from dual4. Round (truncation)S: select cast (-1.002 as int) valueO: select trunc (-1.002) value from dual5. RoundingS: select
Microsoft SQL ServerConverts a character to ASCII ASCII ASCIIString connection CONCAT (expression + expression)Convert ASCII to character CHR CHARReturns the start character in a string (from left) INSTR CHARINDEXConverts the character to lowercase LOWER LOWERConvert characters to uppercase UPPER UPPERpadding string left Lpad N/AClears the beginning blank LTRIM LTRIMClear the trailing blank RTRIM RTRIMThe starting pattern in the string (pattern) INST
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.