Author

Moving TempDB To Another Drive

Because tempdb is re-created each time the instance of SQL Server is started, you do not have to physically move the data and log files. Remember to restart SQL Server after you run the move script for the changes to go into effect. Determine the logical file names of the tempdb database and their current... » read more

Run SQL from Batch File using SQLCMD

The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files through a variety of available modes: At the command prompt. In Query Editor in SQLCMD mode. In a Windows script file. In an operating system (Cmd.exe) job step of a SQL Server Agent job. The utility uses ODBC to execute Transact-SQL batches. Run sql from command... » read more

Windows Batch Script Example

In Windows, the batch file is a file that stores commands in a serial order. Command line interpreter takes the file as an input and executes in the same order. A batch file is simply a text file saved with the .bat or .cmd file extension. It can be written using Notepad or any other... » read more

Using Temp Table

By using SELECT … INTO, you don’t have to define the columns of the temporary table. The temporary table columns will be based on the SELECT columns.

Create Database Backup using Maintenance Plans

Database Server -> Management -> Maintenance Plans -> Maintenance Plan Wizard After the Maintenance Plan has been created… You can edit the maintenance plan using SSMS. A database job will be created for each plan. Note: If you want to remove the backup files after a certain days, make sure you also select the Maintenance... » read more

Linked Server Login Timeout

Error: Linked server timeout after 10 seconds. TCP Provider: Timeout error [258]. [SQLSTATE 42000] (Error 258)  OLE DB provider “SQLNCLI11” for linked server “xxxxxx” returned message “Login timeout expired”. [SQLSTATE 01000] (Error 7412)  OLE DB provider “SQLNCLI11” for linked server “xxxxxx” returned message “Unable to complete login process due to delay in login response”. [SQLSTATE... » read more