sql补漏
索引:聚簇索引clustered 与 非聚簇索引nonclustered 区别 unique唯一索引
系统数据库:master、model、msdb、tempdb。
时间函数:datepart(yy,posttime) 输出的话要转换成char型
convert(nchar(10),datepart(yy,posttime))
存储过程变量不用声明declare
create proc pp1
@i output
as
select @i=datepart(dd,posttime) from aaa where postid=1
print '评论时间:' + convert(nchar(10),@i)
go
drop proc pp1
declare @i int
exec pp1 @i output
触发器要声明变量需要加declare
create trigger tt1
on 表名
for update
as
declare @s
select @s=sum(price) from 表名
print @s
go --待定中吧