Functions in a database are similar to functions in C #
sequentially,
The price is special here.
Print can be printed in the Message bar.
Mathematical functions
Ceiling () The upper limit does not care how big the decimal point is, directly ignore
Floor () lower limit ibid.
Round (column name, number of reserved digits) rounding reserved decimals the last digit in the number of reserved digits is not enough for the next one to look at.
ABS () Absolute---anti-lock 233
Pi () is the query for a PI
SQRT () square root
String functions
Upper () All Caps
Lower () all lowercase
Ltrim/rtrim () remove left or right space trim cannot be used alone to show him the direction.
Replace (' string ', ' value to replace ', ' what value to replace ') replaces if there are multiple values in the string that need to be replaced
SUBSTRING (' string ', ' index value ', ' intercept quantity ') intercept the index value here from 1, or you can precede it with left or right to start
Len () length Gets the length of the string this is different from the length in C #.
Conversion Functions
Here is an example first;
Select Code+name from Car; The query here will display the code and name two varchar type Lian as a string concatenation.
Similarly, if it is a column of two value types, it will follow the mathematical operation
Convert (type, column name) type conversion
Cast (column name as type)
Time-Date function
GETDATE () Gets the current time
Year (GETDATE ()) Gets the years in the current time
Month (GETDATE ()) Gets the months in the current time
DAT (GETDATE ()) Day
IsDate (time date) determines whether the time date is correctly returned by the bit type
DATEADD (plus what time, plus how much, time and date) add time
Datename () query time, in parentheses fill in the time format to be queried
Datename (Weekday, time) get the day of the week
Week, time of week
Day, days of the week
DayOfYear, the day of the year
SQL Server function Chapter mathematical Functions, String functions, conversion functions, time-date functions