When I started working with SQL, my mentor had a list of cliconfg entry that I needed to add to my laptop. But at this time, we weren’t sure if there was a way to import his entry into my laptop so we ended up doing screenshots, then, I had to manually entered it into [...]
Archive for March, 2007
Finding a specific word in a sproc
back in 2006, a co-worker asked if there’s a way to find specific words in a sproc. The person who wrote this little script is unknown CREATE PROCEDURE USP_FindWordsInaSP @Watchword varchar(50) AS SELECT distinct ‘type’ = case type when ‘FN’ then ‘Scalar function’ when ‘IF’ then ‘Inlined table-function’ when ‘P’ then ‘Stored procedure’ when ‘TF’ [...]
Replication woe
a while back when I was working on replication early one morning, I ran into a problem. I dropped all replication for a certain database but when I tried to ALTER a table that’s used for replication, I got an err stating that the table is used for replication… WTF?! I dropped replication already. Anyways [...]
Service Principle Name (SPN)
I’ve read this a few times and I still don’t really get it Service principal names are associated with the security principal (user or groups) in whose security context the service executes. SPNs are used to support mutual authentication between a client application and a service. An SPN is assembled from information that a client [...]
fillfactor general rule of thumb
Fillfactor general rule of thumb: 100% filled factor for tables with almost no data modification 90% for low activity 70% for medium activity 50% or lower for high activity I got that from a SQL book I was reading.
getting yesterday’s date
A dev asked me how to get correctly get yesterday’s date … yeah … I know but whatever. 2 ways I would go about this: 1. select getdate() – 1 2. select dateadd(dd,-1, getdate())
listing users of fixed and non-fixed sql roles
This is one of my most often used command and it is so simply, I forget it most of the time LOL. I call it: task17
SQL Srv Info
use this little app to find out the license type, product version, etc …
dbo is not linked
dbo isn’t linked to any account, pretty easy fix sp_changedbowner ‘sa’
sync up an orphan user
Here’s a piece of code that will loop thru a database and synch up orphan users USE [dbName] –Change to active database name go DECLARE @UserName nvarchar(255) DECLARE orphanuser_cur cursor for SELECT UserName = name FROM sysusers WHERE issqluser = 1 and (sid is not null and sid 0×0) and suser_sname(sid) is null ORDER BY [...]