Skip to main content

Posts

Showing posts with the label Visual Studio

Flexible Custom Reports for SQL Server

Flexible Custom Reports for SQL Server This article is written by developer for other developers, sharing my experience with a technique that I found in Kimberly Tripp's SQL Server blog article titled " Building High Performance Stored Procedures ". In her article, she demonstrated a dynamic SQL technique that allows for "Query By Example" screens that allow most fields to be optional. I would strongly encourage you to read her article along with the associated cautionary notes. I would further add that this technique should not be used for any automated reporting tasks. If you have a known report requirement, make a dedicated stored procedure for it! I am writing this article to share a few refinements as well as a nice way to catch refactoring dependencies when this stored procedure is part of a database project in Visual Studio.  As a point of reference, I used MS SQL 2014 and Visual Studio 2017, but the technique should work with older versions of SQ...

Search and Replace in Visual Studio 2005

I usually have to look this up, so I am posting it to my blog. Visual Studio 2005 has a "Regular Expression" option on the "search and replace" dialog. (Previous .Net editions had it as well.) I occasionally want to rewrite several lines of text without writing a macro or wearing out my fingers. Here's what I do ... If I have a file with several lines of DECLARE R1 = VC WITH CONSTANT("TEST1") DECLARE R20 = VC WITH CONSTANT("TEST2") DECLARE R31 = VC WITH CONSTANT("TEST3") DECLARE R42 = VC WITH CONSTANT("TEST4") And I would like to convert these to SET R1 = "TEST1" SET R20 = "TEST2" SET R31 = "TEST3" SET R42 = "TEST4" I would search for "declare [R|r]{.*} = .* with constant\({.*}\)" and replace with "set r\1 = \2" (don't add quotes into the search dialog). This grabs the text in curly braces and assigns it to \1 and \2, so I can re-assemble it as I wish. I...