这是一个小问题,但对我来说真是太痛苦了.通常,我会在其中编写包含多个查询的存储过程.为了使调试更容易,我这样写:
print 'Some notes about query 1' select * from soMetable print 'some notes about query 2' update soMetable set column = null
然后我得到这样的结果:
Some notes about query 1 (8 row(s) affected) Some notes about query 2 (8 row(s) affected)
它们的空间本身使它难以阅读.我希望结果看起来像这样:
Some notes about query 1 (8 row(s) affected) Some notes about query 2 (8 row(s) affected)
我知道它很小,但它让我很烦.有人有什么想法?
解决方法
汇总你得到的答案:
--Set up test data DECLARE @soMetable AS TABLE(id int identity,somevalue int) INSERT INTO @soMetable (somevalue) VALUES (1) INSERT INTO @soMetable (somevalue) VALUES (2) INSERT INTO @soMetable (somevalue) VALUES (3) INSERT INTO @soMetable (somevalue) VALUES (4) INSERT INTO @soMetable (somevalue) VALUES (5) INSERT INTO @soMetable (somevalue) VALUES (6) INSERT INTO @soMetable (somevalue) VALUES (7) INSERT INTO @soMetable (somevalue) VALUES (8) --Here's the method. SET NOCOUNT ON --As kd7 said this will get rid of spaces. Along with the rowcount. print 'Some notes about query 1' select * from @soMetable print '(' + CONVERT(varchar,@@rowcount) +' row(s) affected)'--This adds the row count back in print '' --Formatting row to add the space you require. print 'Some notes about query 2' update @soMetable set somevalue = null print '(' + CONVERT(varchar,@@rowcount) +' row(s) affected)'