Thursday, May 19, 2016

Run SQL with different windows login

Hold Shift down and right click on the SQL Server Mangement studio icon. Select "Run as different user".

Tuesday, May 10, 2016

Id int identity(1,1) primary key

I spend a good bit of time over the years tuning slow code. A simple identity column can speed up code compared to a Heap. Is it always the best possible PK? No.

CREATE TABLE [dbo].[SampleTable1](
         id int identity(1,1) primary key,
[f_name] [varchar](24) NULL,
[addresss] [varchar](50) NULL)

People will argue endlessly over PKs and Clusters. Without a cluster Inserts are slower. Very rarely do we see a single disk server or a 5 spindle RAID array. The more spindles in a san the more exterme the fragmentation.