请有人告诉我。
哪种语法正确?
DECLARE @TotalRows INT
SET @TotalRows = (SELECT COUNT(*) FROM MyTable WHERE MyID = Value)
OR
DECLARE @TotalRows INT
SELECT @TotalRows = COUNT(*) FROM MyTable WHERE MyID = Value
甚至重要吗?
答案 0 :(得分:3)
Difference between set vs select