环境:sqlserver 2008 r2
问题:不清楚sqlserver 里的注释用法。
解决:
单行注释:--
多行注释:/*......*/
使用示例:
单行注释:
-选择列表中的列 'student.sname' 无效,因为该列没有包含在聚合函数或 group by 子句中。 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. 列名 'sno' 不明确。 having min(grade) >= 60 order by avg_g desc;
多行注释:
/*
把对student表和course表的全部权限授予用户u2和u3
grant all priviliges www.jb51.net
on table student, course
to u2, u3;
把对表sc的查询权限授予所有用户
grant select on table sc
to public;
把查询student表和修改学生学号的权限授给用户u4
grant update(sno), select
on table student to u4;
把用户u4修改学生学号的权限收回
revoke update(sno) on table student from u4;
*/
效果图: