About Me

My photo
a Dynamic and Energetic guy.....

Thursday, September 27, 2012

Shrink All Databases In SQL 2008 Using A Query

IF EXISTS(select * from sysobjects where id = object_id('dbo.SP_ShrinkAllDatabasesOnServer') and xtype = 'P')
DROP PROCEDURE dbo.SP_ShrinkAllDatabasesOnServer
GO
CREATE PROCEDURE dbo.SP_ShrinkAllDatabasesOnServer
AS
BEGIN
CREATE TABLE #TempDatabasesTable
(
[DatabaseName] sysname not null primary key,
Mod tinyint not null default 1
)
INSERT INTO #TempDatabasesTable ([DatabaseName])
SELECT
name
FROM
master..sysdatabases
WHERE
dbid > 4
DECLARE @DatabaseName sysname
SET @DatabaseName = ''
WHILE @DatabaseName is not null
BEGIN
SET @DatabaseName = NULL


SELECT TOP 1 @DatabaseName = [DatabaseName] from #TempDatabasesTable where Mod = 1
IF @DatabaseName is NULL
break
print '*******************************************************************'
print '> DB: ' + @DatabaseName
print '> SET RECOVERY MODE SIMPLE'
declare @SqlCommand nvarchar(4000)
set @SqlCommand = 'ALTER DATABASE [' + @DatabaseName + '] SET recovery simple'
exec sp_executesql @SqlCommand
print '> Shrinking database'
set @SqlCommand = 'dbcc shrinkdatabase([' + @DatabaseName + '])'
exec sp_executesql @SqlCommand
update #TempDatabasesTable set Mod = 0 where [DatabaseName] = @DatabaseName
end
DROP TABLE #TempDatabasesTable
END
GO
exec dbo.SP_ShrinkAllDatabasesOnServer

Monday, September 17, 2012

SharePoint 2010 Integration With SSRS

When we have to integrate SharePoint 2010 with SSRS, it is few steps away from the fun.

1) First we have to download and install SSRS plug-in for SharePoint 2010



2) Go to Central Administration --> General Application settings --> Reporting Services

3) Set "Report Server URL" and Account Credentials

4)  Verify Status of configuration
5) Go to Site Collection features  --> Activate "Reporting Server Integration Feature"
6) Go to Edit page and insert "WebPart"

7) Configure a SSRS Report and have data


That's all :)


My Masters