Using the While loop statement and the variable output 99 multiplication table

Source: Internet
Author: User

-Set Variable i
DECLARE @i int
--Set Variable J
DECLARE @j int
--Set the multiplication table variable
DECLARE @Multiplication Table varchar (500)
--Give i,j, @Multiplication table to assign the initial value
Select @i=9,@j=1, @Multiplication table= "
--Print 99 multiplication table using while loop statement and variable
While @i>=1
Begin
Set @[email protected]
While @j>=1
Begin
Select @Multiplication Table=convert (char (2), @j) + ' x ' +convert (char (2), @i) + ' = ' +convert (char (2), @i*@j) + ' [email Protected] Table
Set @[email protected]
End
Set @Multiplication Table=char [email protected] Table
Set @[email protected]
End
Print @Multiplication Table

Using the While loop statement and the variable output 99 multiplication table

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.