Author: Uma Mahesh

Restriction Operator in LINQ

Restriction Operatorswhere is the restriction operator. It applies filter criteria on the sequence. The values of the sequence are filtered based on a supplied predicate. The where operator does not initiate the execution of the query. The query is executed when enumeration over the object is initiated, at which point the filter is applied. This

Finding Possible Bad Indexes in SQL Server

CREATE PROCEDURE FindPossibleBadIndex AS BEGIN -- Possible bad Indexes (writes > reads) DECLARE @dbid INT SELECT @dbid = DB_ID() SELECT 'Table Name' = OBJECT_NAME(s.object_id), 'Index Name' = i.name, i.index_id, 'Total #of Writes' = user_updates, 'Total #of Reads' = user_seeks + user_scans + user_lookups, 'Difference' = user_updates - ( user_seeks + user_scans + user_lookups ) FROM

Finding Missing Indexes

The Below script will brings the Missing Indexes in the databases -- =================================================== -- Author: V.U.M.Sastry Sagi -- Create date: 01/30/2011 -- Description: Fetches the Missing Indexes -- =================================================== CREATE PROCEDURE [DBO].[FINDMISSINGINDEXES] AS BEGIN SELECT MID.STATEMENT, MIGS.AVG_TOTAL_USER_COST * ( MIGS.AVG_USER_IMPACT / 100.0 ) * ( MIGS.USER_SEEKS + MIGS.USER_SCANS ) AS IMPROVEMENT_MEASURE, OBJECT_NAME(MID.OBJECT_ID), 'CREATE INDEX [MISSING_INDEX_'

Finding the size of the Tables inside a DB

The Below code will fetches each Table Name,# of Rows in that table, Reserved Size, Index Size,UnUsed Space in the given Database. -- =================================================== -- Author: V.U.M.Sastry Sagi -- Create date: 01/12/2011 -- Description: Fetches the tables and the size useage of each table -- =================================================== CREATE PROCEDURE [DBO].[SPACEUSED] @SOURCEDB VARCHAR(128) AS SET NOCOUNT ON

Executing FTP Commands from SQL Server

Below Code will execute FTP Commands from SQL Server. First thing you need to take care is create a text file with the name “ftp” and type all your ftp commands and then create the below procedure in SQL Server -- ============================================= -- Author: V.U.M.Sastry Sagi -- Create date:12/28/2010 -- Description: Executes a FTP Command
SiteLock