Connect to SQL Server When SA Account or Service Account Credentials not Available : I recently inherited the SQL Serer which was running under a user account who left the company and no one knows the password for sa account. My task was to fix …
Move SQL Server Database to Different Location
Move SQL Server Database to Different Location : There are several way to do this but I find this option being simple.Sometimes we face the issue with Drive being full. It happens when we have Database on C Drive and we usually don’t allocate much …
SQL Server Waits and Queues
SQL Server Waits and Queues : I watched Paul Randall Videos on Wait Types and which inspired me to write a simple post on wait types on logical way. We all have written queries, TSQL statements to perform CRUD ( Create, Read, Update , Delete …
SQL Join Diagram and Query
SQL Join Diagram and Query Create TableA and TableB and Populate Data CREATE TABLE TableA ( ID INT IDENTITY(1, 1) , [Key] NVARCHAR(255) , Value NVARCHAR(4000) , CreatedDateTime DATETIME2 DEFAULT GETUTCDATE() , CreatedBy NVARCHAR(50) DEFAULT CURRENT_USER , Status TINYINT DEFAULT 1 ); CREATE TABLE TableB …
Common SQL Tasks I Do and Scripts
Common SQL Tasks I Do and Scripts Restore a database from Backup : RESTORE FILELISTONLY FROM DISK = ‘\\FileShare\Database\Database.bak’ RESTORE DATABASE SmarterTrack FROM DISK = ‘\\FileShare\Database\Database.bak’ WITH REPLACE , MOVE ‘SmarterTrackModel’ TO ‘G:\SQLServer\MSSQL10_50.DEV2008R2\MSSQL\DATA\SmarterTrack.mdf’ , MOVE ‘SmarterTrackModel_log’ TO ‘G:\SQLServer\MSSQL10_50.DEV2008R2\MSSQL\DATA\SmarterTrack_log.ldf’ EXEC sp_helpdb ‘SmarterTrack’ Run Multiple SQL Files …
Common SQL Errors and Solutions
Error : Msg 7411, Level 16, State 1, Line 1 Server ‘DEVSQLDEV2008’ is not configured for RPC. Solution : exec sp_serveroption @server=’DEVSQLDEV2008′, @optname=’rpc’, @optvalue=’true’ exec sp_serveroption @server=’DEVSQLDEV2008′, @optname=’rpc out’, @optvalue=’true’ Error : 2014-09-11 16:14:23.410 Logon SSPI handshake failed with error code 0x8009030c while establishing a …
Measure T-SQL / Stored Procedure Performance
Measure T-SQL / Stored Procedure Performance If you are using SQL Server or dealt with SQL Server in any fashion, you might have heard this million times, How do you measure the TSQL ( Adhoc ) or Stored Procedure Performance. I have been using Microsoft SQL …
SQL Server – Orphaned Users
SQL Server – Orphaned Users A database user for which the corresponding SQL Server login is undefined or is incorrectly defined on a server instance cannot log in to the instance. Such a user is said to be an orphaned user of the database on …