Thursday 17 September 2015

How to kill all sessions for single Database in SQL server



Please find below query:

DECLARE @DatabaseName nvarchar(50)
SET @DatabaseName = N'Name _of_Database'
--SET @DatabaseName = DB_NAME()

DECLARE @SQL varchar(max)
SET @SQL = ''

SELECT @SQL = @SQL + 'Kill ' + Convert(varchar, SPId) + ';'
FROM MASTER..SysProcesses
WHERE DBId = DB_ID(@DatabaseName) AND SPId <> @@SPId

-- SELECT @SQL
EXEC(@SQL)

What is Clutter in Outlook


Whenever we tired of unknown and unwanted mails, In such case we apply rules in outlook and unwanted mails automatically moved to the defined folder. But as we know there is limitation of defining number of rules in outlook. Sometime your rules gets disabled and to overcome this Microsoft introduced Clutter in Outlook. Clutter" can help you filter low-priority email, saving time for your most important messages. The email server keeps track of the email you read and the ones you don't. Once you turn it on, Clutter is automatic. As new email comes in, it takes messages you're most likely to ignore and puts them into the "Clutter" folder. The more you use it, the better it gets. And if you find Clutter isn't for you, you can turn it off.

My experience with Clutter is quit good and i appreciate for this amazing feature. 

Check if column exists or not in the SQL server

--method 1 IF EXISTS(SELECT 1 FROM sys.columns with (nolock)           WHERE Name = N'LoginName'           AND Object_ID = Objec...