Q&A archive

Stack Exchange Answers

Questions and answers Andy Mallon contributed across the Stack Exchange network.

DBA Stack Exchange

how azure sql geo replication works internally?

Question My company moved to azure and started to use azure Sql database and geo replication. For our on-premise servers, we heavily rely on Microsoft transactional replication to move data. Now we setup transactional replication between on-premise server …

Read answer

DBA Stack Exchange

SQL Visual Studio Find and Replace in Publish Profile

Question We have source control in Visual Studio Database Projects (SSDT). To make cross database references, we utilize something like this below in Project References. We need Project references, since Otherdatabase, can choose between two options at our …

Read answer

DBA Stack Exchange

How Large Table before Using Clustered Columnstore Index

Question At what size should we consider applying Columnstore Index on a table? Is there a SQL Server storage or design guidance? Our Data Warehouse is 5TB total. Additionally, we have tables which are 100GB to 1TB which compose the database. Just curious if …

Read answer

DBA Stack Exchange

How do you SUM a column without having its name?

Question I'm stuck in a way that how to do sum on a column let's say first column of a table (result from another query) without knowing the column name with something like column position id. it's something like this

Read answer

DBA Stack Exchange

LOG_RATE_GOVERNOR Wait Stat

Question I'm noticing this wait stat on my Azure SQL database, and I've never seen it before. I've tried Googling this wait stat but haven't been able to come up with any good information on what this is, although I saw a couple mentions of it possibly being …

Read answer

DBA Stack Exchange

Rebuild Very Large Primary Key Index

Question I have a SQL database that is hosted on Azure. The problem is that the size is getting out of control, I can see up to 99% fragmentation in the Primary Key clustered indexes. I'm able to rebuild all other indexes with online=on option and it won't …

Read answer

DBA Stack Exchange

Can SQL Server 2016 log files be applied on SQL Server 2012

Question This is in relation to a rollback scenario from a 2012 -> 2016 upgrade. The scenario is that the SQL Server 2012 database is restored onto 2016 and log files applied until it is up to date. Then production systems are cut over to 2016. Database is …

Read answer

DBA Stack Exchange

SQL Server FCI won't start after OS Upgrade

Question I have a two node sql server 2008 r2 cluster that we just did an OS upgrade from windows 2008 r2 to windows 2012 r2, the OS upgrade was done in place so the SQL Server Installation stayed in tack. The cluster role won't come back online saying it's …

Read answer

Stack Overflow

Spread workload with always on high availability groups

Question I am wondering if it is possible to split up a very large query to have parts of it done on the secondary read only servers, or If this feature only allows me to run separate queries or scripts on the secondary servers. I would also like to know if …

Read answer

DBA Stack Exchange

What is the row overhead when using Page Compression?

Question I have created a table with 650 Numeric(19,4) columns. When I switch on Page Compression, by running ALTER TABLE fct.MyTable REBUILD WITH (DATA_COMPRESSION = PAGE); I get Msg 1975, Level 16, State 1 Index 'PK_Mytable' row length exceeds the maximum …

Read answer

DBA Stack Exchange

Why does it take so long to view logs on a server?

Question I am just trying to look up more verbose information for a maintenance plan task that failed. I open up the log file viewer and check the box to view the logs for my maintenance plan. There are no active filters besides that in this example. Then I …

Read answer

DBA Stack Exchange

Load balancing reads SQL Server 2016 AG

Question I'm trying to balance read traffic between two SQL Server 2016 Enterprise Edition instances (Primary and Secondary) using availability groups and the read only routing. Here is my current setup: The servers are in AWS in two different AZ The servers …

Read answer

DBA Stack Exchange

Troubleshooting Powershell errors from SQL Agent job

Question I have a powershell script that I am trying to add in to a sql agent job, but the job step is failing with the following error A job step received an error at line 1 in a PowerShell script. The corresponding line is 'import-module SQLPS …

Read answer

DBA Stack Exchange

Transaction Replication on AlwaysOn

Question In our AlwayOn environment I have two SQL servers 2014 Ent.edition (SERVER A, and SERVER B). I setup a transaction replication for [database A ], pointing to listener which shouldn't cause any issue if a failover happened. Tested, worked just fine …

Read answer

DBA Stack Exchange

Preventing SQL injection in dynamic SQL

Question Let's imagine a stored procedure that retreives data and do some kind of pagination. This procedure has some inputs describing which set of data we want and how we sort it. Here is a very simple query, but let's take it as an example.

Read answer