140911 SQL Programming

Source: Internet
Author: User

Local variable local variables must begin with @ and must be described with the DECLARE command before they can be used.  Use the Select or SET command to set the value of the variable. Description form: DECLARE @ variable name variable type [@ variable name variable type] SELECT @ local variable = variable value    SET @ local variable = variable value    IF ... ELSE ... IF < conditional expressions > < command line or program block >    [ELSE IF [conditional expression]    < command line or program block;]    BEGIN ... END ... BEGIN < command line or program block >       END  BEGIN ... END is used to set a program block that will be at begin ... All programs in END are treated as one unit execution. BEGIN ... END often in conditional statements such as if ... ELSE used in. The WAITFOR WAITFOR command is used to temporarily stop the execution of the program until the waiting time has been set or the time has been set to continue. Where time must be a datetime type of data WAITFOR {Delay < ' time ' > | Times < ' time ' >| Errorexit | ProcessExit | Mirrorexit}  delay is used to set the wait time up to 24 hourstime is used to set the point at which the wait endsErrorexit until a non-normal interrupt is handledProcessExit until normal or non-normal interrupts are handledMirrorexit until the mirror device failsExample:  wait 1 hours, 2 minutes, 3 seconds before executing the SELECT statement   waitfor delay ' 01:02:03 '  SELECT * FROM Employee  The SELECT statement is not executed until 11 o'clock 8 minutes after the night   waitfor time ' 23:08:00 '  SELECT * FROM Employee

140911 SQL Programming

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.