Sql-exec

--显示sql server现有的所有数据库
exec sp_helpdb

--查看数据表设置的约束

exec sp_helpconstraint SubjectType

--update select出来的结果集的字段
update QuestionToAnswer
    set IsDel=1,Marker=15,MarkingTime=getdate()
    where ID in
    (select QTA.ID from QuestionToAnswer QTA    --QTA.ID,QTA.StudentID,QTA.IsDel,QTA.Score
    inner join TClassStudent TCS on QTA.StudentID=TCS.StudentID and QTA.IsDel=0 and TCS.IsDel=0
    where QTA.QuestionID=52 and TClassID=9)
原文地址:https://www.cnblogs.com/zhyue93/p/sql3.html