SqlSever comments: single-line comments and multi-line comments; sqlsever multi-line comments

Source: Internet
Author: User

SqlSever comments: single-line comments and multi-line comments; sqlsever multi-line comments

Environment: SQLServer 2008 R2
Question: I am not clear about the usage of annotations in SQLServer.

Solution:

Single line comment:--
Multi-line comment:/*......*/

Example:

Single line comment:

-Selecting the column 'student. sname' in the list is invalid because the column is not included in the aggregate function or group by clause. SELECT Student. sno, sname, AVG (grade) AS avg_g FROM Student, SC www.jb51.net WHERE Student. sno = SC. sno AND cno <> '008 'group by Student. sno -- Student not added. the column name 'sno' is not clear. Having min (grade)> = 60 order by avg_g DESC;

Multi-line comment:

/* Grant all permissions ON Student and Course tables TO users U2 and U3 grant all priviliges www.jb51.net on table Student, Course TO U2, U3; GRANT the query permission ON the table SC to all users GRANT the select on table SC TO PUBLIC; GRANT the user the permission TO query the Student TABLE and modify the Student ID TO U4 GRANT UPDATE (Sno ), select on table Student TO U4; revoke update (Sno) on table Student FROM U4 FROM user U4's Student ID modification permission ;*/

:

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.