RDS – Log Off vs Disconnect

Remote Desktop Services (RDS or RDP) and Terminal Services provide two options when closing a client session: you can either “Log Off” or “Disconnect“. Log Off – Ends the session running on the remote computer or server. Any applications running within the session will be closed and unsaved changes made to open files will be lost.... » read more

Create Partition Table With Date Column

SELECT DATEFROMPARTS(YEAR(GETDATE()),MONTH(GETDATE()),1) Note: Always use date type for partition column. Make sure the following are created for partition… Partition File Group (Folder structure has been created as well) Partition Function Partition Schema Partition Table Note: If the database is part of Always On, make sure the folder structure has been created on the secondary servers... » read more

Refresh View Object After Update

sp_refreshview Updates the metadata for the specified non-schema-bound view. Persistent metadata for a view can become outdated because of changes to the underlying objects upon which the view depends. Run the following SP to refresh all views in the database, after there was database object modifications. Sources: https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-refreshview-transact-sql?view=sql-server-ver15

Create SQL Job Script

Go to … SSMS -> Specific Database Server -> SQL Server Agent -> Jobs -> Specific Job -> Script Job as Note: Make sure to change the schedule quid id if you replicate from a previous job.

Moving Large Database Backup File

Tips for moving large backup file. Create multiple backup files instead of one large backup file. Use file compression programs like WinZip to compress backup file. Consider trimming the data in the database before creating the backup file. Create database and data from scripts. 7zip You can also use software like 7zip to compress and... » read more

Unable to start SQL Server Service

Problem: Unable to start SQL Server Service. Check Windows Logs in “Event Viewer”. Cause: FCB::Open failed: Could not open file C:\MSSQL\tempdb.mdf for file number 1. OS error: 3(The system cannot find the path specified.). Problem with tempdb. Unable to find tempdb drive.