不让 Select 返回结果集
Use test ;
Select * from t1 ;
-- Select 会返回结果集![]()
Declare @temp int ;
Select @temp = COUNT(*) from t1 ;
-- 不返回结果集![]()
这不是摆弄, 而是当你在程序中写 SQL 语句并期待数据库返回结果集的时候非常有用. 因为同时执行多个 Select 语句返回多个结果集, 对程序的分析增加了不必要的复杂性.
Use test ;
Select * from t1 ;
-- Select 会返回结果集![]()
Declare @temp int ;
Select @temp = COUNT(*) from t1 ;
-- 不返回结果集![]()