Script to update the dates on AdventureWorks database

In case you ever needed this: IF OBJECT_ID('tempdb..#GeneratedScripts') IS NOT NULL DROP TABLE #GeneratedScripts; CREATE TABLE #GeneratedScripts (Id INT IDENTITY(1,1), SqlScript NVARCHAR(MAX)); -- 1. Setup global ceiling INSERT INTO #GeneratedScripts (SqlScript) VALUES ('DECLARE @TargetCeiling DATETIME = GETDATE();'); DECLARE @SchemaName NVARCHAR(256), @TableName NVARCHAR(256), @AnchorColumn NVARCHAR(256); DECLARE @Sql NVARCHAR(MAX), @ColumnUpdates NVARCHAR(MAX); DECLARE tbl_cursor CURSOR FOR SELECT DISTINCT … Continue reading Script to update the dates on AdventureWorks database

An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database – when migrating SSRS databases to a new server

You have restored your databases, you renamed them if needed (in my case ReportServer and ReportServerTempDB from ReportServer$Instance and ReportServer$InstanceTempDB), jobs, everything, when migrating SSRS to a new server. Yet, scheduled subscriptions still not working (oddly enough, ad-hoc ones were working, could browse reports, etc.). In my case, when I tried editing Subscriptions, I hit … Continue reading An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database – when migrating SSRS databases to a new server

Wierd tuning trick with dynamic SQL when encountering unmatched indexes

Later edit: Both Uwe Ricken (https://www.linkedin.com/in/uwericken/, https://www.db-berater.de/) and Sascha Lorenz (https://www.linkedin.com/in/saschalorenz/) correctly pointed out that my little inconsisted writing was a tad too inconsistent - first of all, the title itself was NOT highlighting the very point of this blog post: unmatched indexes and how to deal with them by using dynamic SQL. Truth be … Continue reading Wierd tuning trick with dynamic SQL when encountering unmatched indexes

Stop using variables in stored procedures for no reason

Yes, writing about SQL Server every 10 years will not bring me any medals. I know, I know.Anyway, I am currently checking what is what on a new project and I got to see this in the header of a stored procedure from 10 years ago: "use @variable to suppress 'parameter sniffing'".I will NOT dwelve … Continue reading Stop using variables in stored procedures for no reason

Collecting blocking chain

We've all been there, trying to figure out who's blocking who, who is the most avid blocker. Personally, I was and still am a huge fan of Adam Machanic's (b) sp_WhoIsActive for accomplishing that. But I stumbled upon a nice script from @SQL_Undercover (b|t) which is using sp_BlitzWho stored procedure. For the ones not familiar … Continue reading Collecting blocking chain

Change the PowerBI desktop default language

For whatever reason, I ended up with Romanian as the default language for PowerBI desktop (no regional settings, no browser settings, no nothing would provide a hint to the installer that it should install and set the app to Romanian). This did not help either: https://community.powerbi.com/t5/Service/change-PowerBI-language-menus-to-english-while-maintaining/td-p/4782 I ended up in C:\Program Files\Microsoft Power BI Desktop\bin, … Continue reading Change the PowerBI desktop default language

Say What? – “Management Studio: must be set in single thread apartment (STA) mode before OLE calls can be made”

Yes, I have another couple of minutes to document this weird message. I was trying to access the database properties for one of our databases. Guess what: I couldn't as there was no owner! Well, the easiest thing to do is to alter the authorization on the database; as you may have guessed it already, … Continue reading Say What? – “Management Studio: must be set in single thread apartment (STA) mode before OLE calls can be made”