SQL SERVER – sqlcmd – Using a Dedicated Administrator Connection to Kill Currently Running Query

People are judged from their questions and not their answers. I received wonderful question the other day. How sqlcmd can be used along with currently running query script posted on your blog? Please read following two posts before continuing this article as they cover background of this article. SQL SERVER…
Read More

SQL SERVER – Find Currently Running Query – T-SQL

This is the script which I always had in my archive. Following script find out which are the queries running currently on your server. SELECT sqltext.TEXT, req.session_id, req.status, req.command, req.cpu_time, req.total_elapsed_time FROM sys.dm_exec_requests req CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext While running above query if you find any query which is running for…
Read More

SQL SERVER – 2008 – Change Color of Status Bar of SSMS Query Editor

This is one very interesting issue which I have started to follow recently. Just like any other organization my company has many servers. Some are production and some are development. It is very much necessary that query which are written for developer environment does not run for production environment accidentally.…
Read More

SQL SERVER – Fix : Msg 15151, Level 16, State 1, Line 3 Cannot drop the login ‘test’, because it does not exist or you do not have permission

I got following error when I was trying to delete user ‘test’ with ‘SA’ login. I was little surprised but then I tried to delete with the windows authenticated systemadmin account. Once again I got the same error. Msg 15151, Level 16, State 1, Line 3 Cannot drop the login…
Read More

SQL SERVER – Fix : Error : Msg 15151, Level 16, State 1, Line 2 Cannot alter the login ‘sa’, because it does not exist or you do not have permission

Few days ago, I have wrote about SQL SERVER – DISABLE and ENABLE user SA I received following email from one of the user who received following error. Msg 15151, Level 16, State 1, Line 2 Cannot alter the login ‘sa’, because it does not exist or you do not…
Read More