SQL Server knowledge Point record sharing

Source: Internet
Author: User

Introduction to Knowledge points

  • Two-way search: Here is not a concept, directly say its role
  • ISNULL () function: Determine if the function has a value, if the variable is not assigned to the given value, the following example is if the @TOTALCOUNT variable is null then the assignment is an empty string, if we will @TOTALCOUNT The variable is given an initial value then the print is 0 otherwise it is 1, you can copy run a bit to know

    DECLARE @TOTALCOUNT INT

    IF ISNULL(@TOTALCOUNT,") ="

    PRINT ' 1 '

    ELSE PRINT ' 0 '

  • LTRIM () Remove the left space of the variable
  • RTRIM () Remove the right space of the variable
  • REPLACE () swap character The first argument is a variable name, the second is the source substitution character, and the third is the string to replace
  • CHARINDEX () returns the starting position of the specified expression in the string, CHARINDEX(', ', @UserName) >0, checking if a comma exists in the UserName field
  • UPPER() converts a string to uppercase format
  • SUBSTRING() intercepts a string of a specified length The first argument is a variable name or a table field name, the second argument is the starting index, and the third is the terminating index
  • Cast(@PageSize as varchar) converts the type of the variable to a varchar type
  • Select CEILING(50.0/3) Rounding up, here the return value is 17, notice here the divisor or dividend must have a numeric type, otherwise it is not 17 but 16, hands-on try to know
  • Select floor(50.0/3) or Select floor(3 rounding down, where the return value is 16, note that the divisor or divisor does not need to distinguish between the numeric type, I tested
  • STR() returns character data converted from numeric data , meaning converting a number to a string

SQL Server knowledge Point record sharing

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.