The 16th lecture ++t-sql basic knowledge

Source: Internet
Author: User

define an integer variable and a two-character variable, respectively.
Declare   @name   varchar (tendeclare   @age      smallint ,     @msg   varchar- -  Note: The value of a local variable is null before it is assigned a value

"Welcome to SQL Server 2008" to display the length of the string.
 declare   @msg                                                     int  - -  declare variable     select   @msg  =  len   (' Welcome to SQL Server 2008  ') - -        print  str  ( @msg )  - - Displays the value of the variable 
Statistics XSQK The number of students in the table, asked to display the information as "student table has XX students."
 UseXscj--Switch the XSCJ library to the current libraryDeclare   @rs    smallint                            --declaring VariablesSelect     @rs=Count(*) fromXsqk--assigning values to variablesPrint‘’--Show 1 Blank linesPrint' Students ' table in total '+ Convert(varchar(3),@rs)+' Students '

16th Lecture ++t-sql Basics

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.