Some functions of SQL Server are Note 5

Source: Internet
Author: User
Tags mathematical functions

----handling stringsSelect  Left('abcdef',2)--from left to rightSelect  Right('abcdef',2)--from right to leftSelect Lower('AVc')--Convert to lowercaseSelect Upper('ADSDF')--Convert to uppercasePrint Upper('ADSDF')--Convert to uppercaseSelect Len('Jahlsdakl')--returns the length of an int value stringSelect LTrim('a')--Remove left spaceSelect RTrim('a')--Remove Right spacePrint substring('aaaaaasssss',6,2)--The intercept string index starts at 1.Print Replace('ASDSDKULKHF',' as','GK')--(The target data source string, find which paragraph, replace it with what) the string length can be unequalPrint Replicate('a',5)--Copy the A 5 times .Print Str(123.456,5,1)--A decimal length of 5 decimal places is 1Print Space( -)--Print SpacePrint Patindex("',"')--The starting index of a string in another stringPrint Stuff('skahdjskld',4,2,'PPPPP')--insert ' PPPPP ' from fourth bit and delete back 2 bits starting from fourth bit----Type conversionPrint cast('123' as int)--Converting data typesPrint Convert(int,'123')--Converting data types----Mathematical functionsPrint ABS(- -)--take absolute valuePrint Ceiling(1.23)--ceiling, upper limitPrint  Floor()--FlooringPrint Pi()--PiPrint Rand()--Random numberPrint round(3.1415926,3)--RoundingPrint sqrt()--RadicalsPrint Square()--Square

Some functions of SQL Server are Note 5

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.