Hot answers tagged

4

I would suggest to use Ola's backup solution (and Index maintenance solution as well). This is a well applauded solution that is smart enough to work with mirroring (in your case). Maintenance plans are not bad, but when your environment grows, the limited flexibility and functionality that maintenance plans provide wont be sufficient. For e.g Maintenance ...


3

If this was SQL Server 2012 or later version, you could use the FIRST_VALUE window function: WITH cte AS ( SELECT FirstColC = FIRST_VALUE(ColC) OVER (PARTITION BY ColA ORDER BY ColB ASC) FROM dbo.Table1 ) DELETE FROM cte WHERE FirstColC % 2 = 0 ; In SQL Server 2005 FIRST_VALUE can be replaced with a correlated TOP (1) + ORDER ...


3

I'm not really sure what you are asking but you can tell if a database is online by looking in sys.databases at the state_desc column. Possible values are: ONLINE RESTORING RECOVERING (SQL Server 2008 through SQL Server 2016) RECOVERY_PENDING (SQL Server 2008 through SQL Server 2016) SUSPECT EMERGENCY (SQL Server 2008 through SQL Server 2016) OFFLINE ...


2

The number of records in TransmittedManifests table is much less than the number of records in LWTest. In such scenario, good solution is to use NOT EXISTS approach (as in Query 2) to reduce the number of actual rows. Refer Joins without JOIN - Rob Farley Now, Martin Smith’s comment helped me demystifying the count per execution (estimate) and total count ...


2

Your query is more complicated that it needs to be. DISTINCT is redundant there and the internal subquery is not needed. You could rewrite as: DELETE T FROM Table1 AS T WHERE T.ColA IN ( SELECT ColA FROM Table1 WHERE ColC % 2 = 0 AND OrderByCol = 1 ) ;


1

Yeah, for something like this, Minion Backup is actually going to be a much better solution. It's not only Mirror aware, but it's also AG, and log shipping aware. You can do many things with it HA/DR wise that you can't do with other solutions. For example, you can have it write to different locations when it's in different data centers and you can have it ...


1

As already suggested, you cannot achieve this using backup/restore. You can also not achieve it using log shipping. I would look at using transactional replication perhaps from views, which would define the 60 to 90 day window. Be aware (or make your stakeholders aware) that replication is not free and comes with its own (usually small) performance ...



Only top voted, non community-wiki answers of a minimum length are eligible