Character string date math others: isnull convert row_number select Len ('dshgjkdhsad ') returns the number of characters in the specified string expression, excluding trailing spaces. Itrim ('anc skkmkls') returns the string expression after the leading space is deleted. Select rtrim ('abc ') returns the string expression select Len (itrim ('anc skkmkls') after trailing spaces are deleted. It is used in combination with select Replace ('abcttabchhabc', 'abc', '123 ') string expression 3 replaces all matching items of string expression 2 in string expression 1, and returns the new string substring (string expression, start position, length) Select substring ('abcdef ', 2, 2) return BC return the sub-string select charindex ('ss', 'eefssvss ', 5) Find string 1 in string 2. If yes, return the first matched position, if no value exists, 0 is returned. If either string 1 or string 2 is null, null is returned. You can specify the start position for searching in string 2. Upper
Returns a string expression that converts lowercase data to uppercase.
Select getdate () The current system date and time select dateadd (day, 220, getdate () based on adding a period of time to the specified date, return the new datetime value -- calculate the age select datediff (year, '2017-09-27 ', getdate (); returns the number of date and time boundary numbers across two specified dates. -- Calculate the number of people of age select count (datediff (year, '2017-09-27 ', getdate (); -- random number rand () * select floor (RAND () * 10) random number between 10 and 10 returns the maximum integer less than or equal to the given numeric expression, ignoring the remainder select power (5, 3) returns the value of the given expression multiplied by the specified power. -- Replace null with the specified replacement value select isnull (null, 1000) isnull (Comm, 0). If not null, comm is returned; otherwise, return
0. Select 'my scores: '+ convert (char (20), 100) convert 100 to char type