PRINT 'It''s running downtown from Venice.' Take this example and run it in SSMS: PRINT 'The number of the bus is 2525.' It’s also our biggest problem with PRINT. Let’s focus on the first drawback, because not printing right away defeats the purpose of using PRINT for status messages. PRINT can’t be given variable information without CAST or CONVERT.PRINT statements won’t show up in Profiler.PRINT doesn’t necessarily output anything at the moment it’s called.Turns out, they avoided PRINT because it has some serious drawbacks: Strange, I thought, since those scripts like to report on what statements are running. It wasn’t until a few years ago, when I started contributing to the First Responder Kit at Brent Ozar Unlimited, that I noticed every status message in the kit scripts was thrown with something other than PRINT. After each major statement, I’d throw in a “PRINT ‘Starting duplicate record check…'” or something like that to tell me how far along it was. For years, I relied on using PRINT in my T-SQL to give me updates on my script’s progress in SQL Server Management Studio.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |