Search This Blog & Web

Thursday, March 17, 2011

Drop User connections of Running Database in SQL SERVER .


Drop all connections by using Following Query

USE master
GO

ALTER DATABASE DBName
SET OFFLINE WITH ROLLBACK IMMEDIATE
ALTER DATABASE DBName
SET ONLINE

You can kill all the processes using a database with this code:

USE master
go

DECLARE @dbname sysname

SET @dbname = 'Database'

DECLARE @spid int
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname)
WHILE @spid IS NOT NULL
BEGIN
EXECUTE ('KILL ' + @spid)
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) AND spid > @spid
END

Remember you cannot kill System connections with second command.

Thursday, March 10, 2011

Embedding Space's on graph at borders in SSRS 2008 or Report Builder 3

We can easily Increase space at start and end of Chart by Using following Property in SSRS 2008 R2

Goto

Horizontal Axis Properties -- > Axis Option tab -- > Axis Type radio button -- > Side Margins


As you can see in image

Side Margin has three values
Auto: space includes on both sides of Chart
Enabled: doest the same
Disabled: Remove the spaces from both sides.