Building a SQL Restore Script When Your Backup Runs
It is handy to have a SQL Restore script ready to go for every backup that you run. Here is a script that will help with that.
It is handy to have a SQL Restore script ready to go for every backup that you run. Here is a script that will help with that.
SQL Server 2017 introduces a new column in the sys.dm_db_file_space_usage system table. The column is modified_extent_page_count, which tells how many pages have been modified in your data file since the last full backup. What is really interesting about this is that with …
Determining how much of your data file has been modified Read more »
From time to time I get asked about checkDB, and there are many solutions out there, but I have one that I generally use that is very simple and does the job. The script below created a stored procedure in …
Yes, you can create temporary stored procedures by prefixing the name of the sproc with a #. The temporary stored procedure is sort of a “leave no trace” stored procedure that is only good for your session. If you use …
The question of how to delete a trigger after a specific date came up. Here is what could be done. If you want to trigger to disappear after a specific date or time, you can just drop the trigger …
How do you check if a database exists, drop it and recreate it for testing purposes? After running the Database Corruption Challenge for several weeks now, I have seen many scripts to drop and recreate a database. This makes it …
It is my pleasure to announce the winners in the Week 4 Database Corruption Challenge. But first how about a rundown of challenge. In order to make up for the difficult time that Challenge #3 was issued, Challenge #4 was …
The following are the steps that I went through to create a more difficult Database Corruption Challenge for Week 4. Here is how I built the database, nothing fancy, however I did add an extra FILEGROUP called [UserObjects]. Notice, that …
Here is a quick video tutorial on how to use the IIF function on SQL Server 2012, SQL Server 2014 0r newer. This was originally part of my free SQL query training for the 70-461 certification exam. Here is the sample …
First lets take a look at two queries using CURSORS, the first one will use the FORWARD_ONLY type cursor, and the second will use the FAST_FORWARD type cursor. These two types sound very similar, but perform quite differently. Now for …
Simple Cursor Example : FORWARD_ONLY vs FAST FORWARD Read more »