I have a folder full of SQL utility scripts which I’ve compiled over the years. One of which would search all stored procedures within a given database for instances of a specified string. This type of script is really helpful if you need to find all routines which reference a specific table column. This morning I [...]
Continue reading about Find Instances of String in DB Objects
I found myself organizing my code snippets the other day. (Go ahead and poke fun at the Type A coder. I deserve it.) I have a folder dedicated to “SQL – Common Routines.” There within, I came across “Flip Bit.sql.” Over the years, I’ve come across quite a few ways to flip a bit in [...]
If you are familiar with financial securities, you know they are uniquely identified by their Ticker (i.e. MSFT) and/or their CUSIP. You probably also know that there are dozens of vendors which provide financial data. Let’s say you needed to provide a security’s price from the most reliable source using the most reliable identifier. How [...]
Continue reading about T-SQL: Prioritize Results From Multiple Sources
In T-SQL, there’s an easy way to concatenate multiple rows into a single string. If you simply need to munge the results together, here’s the down and dirty solution: use Northwind declare @CategoryList varchar(1000) set @CategoryList = ” select @CategoryList = @CategoryList + CategoryName from Categories select ‘Results = ‘ + @CategoryList ————————————————————————————————– Results = [...]
Continue reading about TSQL: Concatenate Multiple Rows into String