<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1152775264120509331</id><updated>2011-11-27T15:58:42.940-08:00</updated><category term='c#'/><category term='xml'/><category term='Windows Mobile'/><category term='Game Consoles'/><category term='IIS 7'/><category term='General'/><category term='Linq'/><category term='T-SQL Scripts'/><category term='SSRS'/><category term='Links'/><category term='Sql Server'/><category term='Others'/><category term='GPS'/><category term='VS 2010'/><category term='Native Code'/><category term='Asp.net'/><category term='.NET Framework'/><category term='Performance Tunning'/><category term='Social Networking'/><category term='Silverlight'/><category term='.NET'/><category term='Windows 7'/><title type='text'>Renjucool.com - "Life Runs on Code"</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.renjucool.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>71</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-9112515609437133452</id><published>2011-07-24T04:59:00.001-07:00</published><updated>2011-07-24T05:52:53.660-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Compare Sql Server Table Constraints</title><content type='html'>&lt;blockquote&gt;   &lt;p&gt;Hello friends, after a long period of time I’m back into my blog. As due to continuous projects didn’t get a long stretch to sit with my blog.&amp;#160; &lt;/p&gt;    &lt;p&gt;In a BI project I faced a lot challenges for migrating some huge databases which ended up with lot of dependencies on sql server schema and object comparison tools(Redgate Sql Data compare,Sql compare,Xsql) to make my SSIS to execute smoothly. Now I’m in a workshop for synchronizing two databases. In the middle of that I’m sharing some useful sql queries which will be useful for happy coding.&lt;/p&gt;    &lt;pre class="sql" name="code"&gt;&lt;br /&gt;IF EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[SP_GET_ALL_CONSTRAINTS]') &lt;br /&gt;and objectproperty(id, N'isprocedure') = 1)&lt;br /&gt;DROP PROCEDURE [dbo].[SP_GET_ALL_CONSTRAINTS]&lt;br /&gt;go&lt;br /&gt;CREATE PROC SP_GET_ALL_CONSTRAINTS&lt;br /&gt;(&lt;br /&gt;	@sourceServer nvarchar(1000),&lt;br /&gt;	@targetServer nvarchar(1000)&lt;br /&gt;)&lt;br /&gt;--@targetServer db to be migrated(old db) eg 12.3&lt;br /&gt;--@sourceServer is the new database having all new schemas scripts   eg:12.4&lt;br /&gt;as&lt;br /&gt;SELECT	&lt;br /&gt;	'NEW'				AS CHANGE,&lt;br /&gt;	DatabaseName		AS DATABASENAME,&lt;br /&gt;	TABLE_NAME			AS TABLENAME,&lt;br /&gt;	COLUMN_NAME			AS COLUMNNAME,&lt;br /&gt;	CONSTRAINT_NAME		AS CONSTRAINTNAME,&lt;br /&gt;	'N-A'				AS NEW_CONSTRAINTNAME,&lt;br /&gt;	CONSTRAINT_TYPE		AS CONSTRAINTTYPE, &lt;br /&gt;	ORDINAL_POSITION	AS ORDINALPOSITION,&lt;br /&gt;	REF_PK_KEY			AS REFERENCEPKKEY,&lt;br /&gt;	ParentTable			AS ParentTable,&lt;br /&gt;	ParentField			AS ParentField,&lt;br /&gt;	TYPE_CLUSTER		AS TYPECLUSTER,&lt;br /&gt;	CASE CONSTRAINT_TYPE WHEN 'PRIMARY KEY'&lt;br /&gt;			THEN 'ALTER TABLE dbo.' + TABLE_NAME + ' ADD CONSTRAINT' + ' ' + CONSTRAINT_NAME + ' PRIMARY KEY (' + COLUMN_NAME + ')' &lt;br /&gt;			WHEN 'FOREIGN KEY' THEN &lt;br /&gt;						'ALTER TABLE dbo.' + TABLE_NAME + ' ADD CONSTRAINT '+ CONSTRAINT_NAME + ' ' + &lt;br /&gt;						CONSTRAINT_TYPE +  '(' + REF_PK_KEY + ') REFERENCES ' + ParentTable + '(' + ParentField + ')' &lt;br /&gt;			ELSE 'ALTER TABLE dbo.' + TABLE_NAME + ' ADD CONSTRAINT ' + CONSTRAINT_NAME + ' UNIQUE (' + COLUMN_NAME  + ')'&lt;br /&gt;			END AS Script&lt;br /&gt;FROM&lt;br /&gt;	tbl_ALL_CONSTRAINTS&lt;br /&gt;WHERE&lt;br /&gt;	DatabASeName = @targetServer&lt;br /&gt;AND&lt;br /&gt;	CONSTRAINT_NAME NOT IN&lt;br /&gt;	(&lt;br /&gt;		SELECT 	CONSTRAINT_NAME&lt;br /&gt;		FROM 	tbl_ALL_CONSTRAINTS&lt;br /&gt;		WHERE	DatabaseName = @sourceServer&lt;br /&gt;		)&lt;br /&gt;UNION ALL&lt;br /&gt;-- select the changed columns&lt;br /&gt;SELECT	&lt;br /&gt;	'MODIFIED'			AS CHANGE,&lt;br /&gt;	v1.DatabaseName		AS DATABASENAME,&lt;br /&gt;	v1.TABLE_NAME		AS TABLENAME,&lt;br /&gt;	v1.COLUMN_NAME		AS COLUMNNAME,&lt;br /&gt;	v1.CONSTRAINT_NAME	AS CONSTRAINTNAME,&lt;br /&gt;	v2.CONSTRAINT_NAME	AS NEW_CONSTRAINTNAME,&lt;br /&gt;	v1.CONSTRAINT_TYPE	AS CONSTRAINTTYPE, &lt;br /&gt;	v1.ORDINAL_POSITION AS ORDINALPOSITION,&lt;br /&gt;	v1.REF_PK_KEY		AS REFERENCEPKKEY,&lt;br /&gt;	v1.ParentTable		AS ParentTable,&lt;br /&gt;	v1.ParentField		AS ParentField,&lt;br /&gt;	v1.TYPE_CLUSTER		AS TYPECLUSTER,&lt;br /&gt;	CASE v1.CONSTRAINT_TYPE WHEN 'PRIMARY KEY'&lt;br /&gt;			THEN 'ALTER TABLE dbo.' + v1.TABLE_NAME + ' DROP CONSTRAINT  ' &lt;br /&gt;					+ v1.CONSTRAINT_NAME  + ' ALTER TABLE dbo.' + v1.TABLE_NAME &lt;br /&gt;					+ ' ADD CONSTRAINT' + ' ' + v2.CONSTRAINT_NAME &lt;br /&gt;					+ ' PRIMARY KEY (' + v1.COLUMN_NAME + ')' &lt;br /&gt;			WHEN 'FOREIGN KEY' THEN &lt;br /&gt;						'ALTER TABLE dbo.' + v1.TABLE_NAME + ' DROP CONSTRAINT ' + v1.CONSTRAINT_NAME  +  ' ALTER TABLE dbo.' + v1.TABLE_NAME &lt;br /&gt;						+ ' ADD CONSTRAINT '+ v2.CONSTRAINT_NAME + ' ' + v1.CONSTRAINT_TYPE  + ' (' + v1.COLUMN_NAME + ') REFERENCES ' &lt;br /&gt;						+ v1.ParentTable + '(' + v1.ParentField + ')'&lt;br /&gt;			ELSE 'ALTER TABLE dbo.' + v1.TABLE_NAME + ' DROP CONSTRAINT  ' &lt;br /&gt;					+ v1.CONSTRAINT_NAME + ' ALTER TABLE dbo.' + v1.TABLE_NAME + ' ADD CONSTRAINT ' + v1.CONSTRAINT_NAME + ' UNIQUE (' + v1.COLUMN_NAME  + ')'&lt;br /&gt;			END AS Script&lt;br /&gt;FROM 	&lt;br /&gt;	tbl_ALL_CONSTRAINTS v1&lt;br /&gt;JOIN&lt;br /&gt;	tbl_ALL_CONSTRAINTS v2&lt;br /&gt;ON&lt;br /&gt;	v1.TABLE_NAME  = v2.TABLE_NAME&lt;br /&gt;AND &lt;br /&gt;	v1.COLUMN_NAME=v2.COLUMN_NAME&lt;br /&gt;AND&lt;br /&gt;	v1.CONSTRAINT_TYPE=v2.CONSTRAINT_TYPE&lt;br /&gt;AND	&lt;br /&gt;	v1.DatabaseName = @sourceServer&lt;br /&gt;AND	&lt;br /&gt;	v2.DatabaseName = @targetServer&lt;br /&gt;AND &lt;br /&gt;	v1.CONSTRAINT_NAME&lt;&gt;v2.CONSTRAINT_NAME&lt;br /&gt;GO&lt;br /&gt;SET ANSI_NULLS ON &lt;br /&gt;GO&lt;br /&gt;	&lt;/pre&gt;&lt;br /&gt;  &lt;p&gt;The below script will populate all the sql server metadata information&lt;/p&gt;&lt;br /&gt;  &lt;pre class="sql" name="code"&gt;&lt;br /&gt;----QUERY to Find out All the Constraints in Detailed&lt;br /&gt;if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_CreateAllConstraintsInTable]') and objectproperty(id, N'isprocedure') = 1)&lt;br /&gt;drop procedure [dbo].[sp_CreateAllConstraintsInTable]&lt;br /&gt;go&lt;br /&gt;CREATE PROCEDURE sp_CreateAllConstraintsInTable &lt;br /&gt;@sourceServer  nvarchar(30), --Database to be compared (New Database)  &lt;br /&gt;@targetServer  nvarchar(30)  --Database to be compared with(Old Database)  &lt;br /&gt;as &lt;br /&gt;declare @sql varchar(max)&lt;br /&gt;&lt;br /&gt;if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tbl_ALL_CONSTRAINTS]') and objectproperty(id, N'istable') = 1)&lt;br /&gt;drop table [dbo].[tbl_ALL_CONSTRAINTS]&lt;br /&gt;&lt;br /&gt;select @sql=&lt;br /&gt;&lt;br /&gt;'	SELECT &lt;br /&gt;	u.TABLESCHEMA,&lt;br /&gt;	u.DatabaseName,&lt;br /&gt;	u.TABLE_NAME,&lt;br /&gt;	u.COLUMN_NAME,&lt;br /&gt;	u.CONSTRAINT_NAME,&lt;br /&gt;	u.CONSTRAINT_TYPE,&lt;br /&gt;	u.ORDINAL_POSITION,&lt;br /&gt;	u.REF_PK_KEY,&lt;br /&gt;	u.ParentTable,&lt;br /&gt;	u.ParentField,&lt;br /&gt;	u.TYPE_CLUSTER into tbl_ALL_CONSTRAINTS&lt;br /&gt;	FROM &lt;br /&gt;	(&lt;br /&gt;		(SELECT &lt;br /&gt;			TAB_CON.CONSTRAINT_SCHEMA AS TABLESCHEMA,&lt;br /&gt;			TAB_CON.TABLE_CATALOG as DatabaseName,&lt;br /&gt;			TAB_CON.TABLE_NAME AS TABLE_NAME,&lt;br /&gt;			KEY_COL.COLUMN_NAME AS COLUMN_NAME, &lt;br /&gt;			TAB_CON.CONSTRAINT_NAME AS CONSTRAINT_NAME,&lt;br /&gt;			TAB_CON.CONSTRAINT_TYPE AS CONSTRAINT_TYPE,&lt;br /&gt;			KEY_COL.ORDINAL_POSITION AS ORDINAL_POSITION,&lt;br /&gt;			RC.UNIQUE_CONSTRAINT_NAME  AS REF_PK_KEY,&lt;br /&gt;			ccu.table_name AS ParentTable, &lt;br /&gt;			ccu.column_name as ParentField, &lt;br /&gt;			ISNULL(CLUST_TYPE.TYPE_DESC,'+ '''NOT APPLICABLE'''+') AS TYPE_CLUSTER &lt;br /&gt;		FROM '+&lt;br /&gt;			@sourceServer+'.INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TAB_CON &lt;br /&gt;		INNER JOIN &lt;br /&gt;			 '+@sourceServer+'.INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KEY_COL  &lt;br /&gt;		ON &lt;br /&gt;			TAB_CON.TABLE_SCHEMA =  KEY_COL.TABLE_SCHEMA  &lt;br /&gt;		AND &lt;br /&gt;			TAB_CON.TABLE_NAME = KEY_COL.TABLE_NAME   &lt;br /&gt;		AND &lt;br /&gt;			TAB_CON.CONSTRAINT_NAME = KEY_COL.CONSTRAINT_NAME  &lt;br /&gt;		LEFT JOIN &lt;br /&gt;			 '+@sourceServer+'.INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC  &lt;br /&gt;		ON &lt;br /&gt;			RC.CONSTRAINT_NAME =  TAB_CON.CONSTRAINT_NAME&lt;br /&gt;		AND &lt;br /&gt;			TAB_CON.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA  &lt;br /&gt;		LEFT JOIN  '+@sourceServer+'.INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu&lt;br /&gt;		ON &lt;br /&gt;			RC.unique_constraint_schema = ccu.constraint_schema &lt;br /&gt;		AND &lt;br /&gt;			RC.unique_constraint_catalog = ccu.constraint_catalog &lt;br /&gt;		AND &lt;br /&gt;			RC.unique_constraint_name = ccu.constraint_name  &lt;br /&gt;		LEFT JOIN  &lt;br /&gt;			(SELECT IDX.OBJECT_ID,IDX.NAME,IDX.TYPE_DESC,SCHEMA_ID FROM SYS.INDEXES IDX JOIN SYS.OBJECTS OBJ ON IDX.[OBJECT_ID] = OBJ.[OBJECT_ID] ) &lt;br /&gt;		AS &lt;br /&gt;			CLUST_TYPE ON OBJECT_NAME(CLUST_TYPE.OBJECT_ID) = TAB_CON.TABLE_NAME &lt;br /&gt;		AND &lt;br /&gt;			CLUST_TYPE.NAME = TAB_CON.CONSTRAINT_NAME  &lt;br /&gt;		AND &lt;br /&gt;			SCHEMA_NAME( CLUST_TYPE.[SCHEMA_ID]) = TAB_CON.CONSTRAINT_SCHEMA  &lt;br /&gt;			)&lt;br /&gt;			union all&lt;br /&gt;		(SELECT &lt;br /&gt;			TAB_CON.CONSTRAINT_SCHEMA AS TABLESCHEMA,&lt;br /&gt;			TAB_CON.TABLE_CATALOG as DatabaseName,&lt;br /&gt;			TAB_CON.TABLE_NAME AS TABLE_NAME,&lt;br /&gt;			KEY_COL.COLUMN_NAME AS COLUMN_NAME, &lt;br /&gt;			TAB_CON.CONSTRAINT_NAME AS CONSTRAINT_NAME,&lt;br /&gt;			TAB_CON.CONSTRAINT_TYPE AS CONSTRAINT_TYPE,&lt;br /&gt;			KEY_COL.ORDINAL_POSITION AS ORDINAL_POSITION,&lt;br /&gt;			RC.UNIQUE_CONSTRAINT_NAME  AS REF_PK_KEY,&lt;br /&gt;			ccu.table_name AS ParentTable, &lt;br /&gt;			ccu.column_name as ParentField, &lt;br /&gt;			ISNULL(CLUST_TYPE.TYPE_DESC,'+ '''NOT APPLICABLE'''+') AS TYPE_CLUSTER &lt;br /&gt;		FROM  &lt;br /&gt;			 '+@targetServer+'.INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TAB_CON &lt;br /&gt;		INNER JOIN &lt;br /&gt;			'+@targetServer+'.INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KEY_COL  &lt;br /&gt;		ON &lt;br /&gt;			TAB_CON.TABLE_SCHEMA =  KEY_COL.TABLE_SCHEMA  &lt;br /&gt;		AND &lt;br /&gt;			TAB_CON.TABLE_NAME = KEY_COL.TABLE_NAME   &lt;br /&gt;		AND &lt;br /&gt;			TAB_CON.CONSTRAINT_NAME = KEY_COL.CONSTRAINT_NAME  &lt;br /&gt;		LEFT JOIN &lt;br /&gt;			'+@targetServer+'.INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC  &lt;br /&gt;		ON &lt;br /&gt;			RC.CONSTRAINT_NAME =  TAB_CON.CONSTRAINT_NAME&lt;br /&gt;		AND &lt;br /&gt;			TAB_CON.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA  &lt;br /&gt;		LEFT JOIN '+@targetServer+'.INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu&lt;br /&gt;		ON &lt;br /&gt;			RC.unique_constraint_schema = ccu.constraint_schema &lt;br /&gt;		AND &lt;br /&gt;			RC.unique_constraint_catalog = ccu.constraint_catalog &lt;br /&gt;		AND &lt;br /&gt;			RC.unique_constraint_name = ccu.constraint_name  &lt;br /&gt;		LEFT JOIN  &lt;br /&gt;			(SELECT IDX.OBJECT_ID,IDX.NAME,IDX.TYPE_DESC,SCHEMA_ID FROM SYS.INDEXES IDX JOIN SYS.OBJECTS OBJ ON IDX.[OBJECT_ID] = OBJ.[OBJECT_ID] ) &lt;br /&gt;		AS &lt;br /&gt;			CLUST_TYPE ON OBJECT_NAME(CLUST_TYPE.OBJECT_ID) = TAB_CON.TABLE_NAME &lt;br /&gt;		AND &lt;br /&gt;			CLUST_TYPE.NAME = TAB_CON.CONSTRAINT_NAME  &lt;br /&gt;		AND &lt;br /&gt;			SCHEMA_NAME( CLUST_TYPE.[SCHEMA_ID]) = TAB_CON.CONSTRAINT_SCHEMA  &lt;br /&gt;		)&lt;br /&gt;	) u&lt;br /&gt;	ORDER BY &lt;br /&gt;		u.TABLESCHEMA, u.CONSTRAINT_TYPE DESC, &lt;br /&gt;		u.TABLE_NAME,u.ORDINAL_POSITION'&lt;br /&gt;exec (@sql)&lt;br /&gt;go&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;p&gt;Get this function also from &lt;a href="http://renjucool.com/fn_display_datatype.sql"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-9112515609437133452?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/9112515609437133452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=9112515609437133452&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/9112515609437133452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/9112515609437133452'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2011/07/compare-sql-server-table-constraints.html' title='Compare Sql Server Table Constraints'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4252626994189221784</id><published>2010-09-26T01:02:00.001-07:00</published><updated>2010-09-26T01:23:26.478-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Social Networking'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Bom Sabado Worm Fix for Orkut</title><content type='html'>&lt;p&gt;Most of the new orkut users are affected with a worm called “BOM SABADO”. Please refrain from login into the new orkut, or you switch to the old one. This worm will send scraps to all of your orkut friends. For safe side you can change your google account password.&lt;/p&gt;  &lt;p&gt;You can get out of this virus by using firefox addon &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1865/"&gt;&lt;strong&gt;Adblock&lt;/strong&gt; &lt;strong&gt;plus&lt;/strong&gt;&amp;#160;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;After installing Click go to Preferences-&amp;gt; Add filter and enter &lt;strong&gt;*tptoos.org/*&lt;/strong&gt; .&lt;/p&gt;  &lt;p&gt;Also Revoke the access to worm in your google account settings.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_hLPHcFodaYU/TJ7-GkRssoI/AAAAAAAAAIg/vugHn__wZPs/s1600-h/gAcc%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="gAcc" border="0" alt="gAcc" src="http://lh5.ggpht.com/_hLPHcFodaYU/TJ7-HS7pryI/AAAAAAAAAIk/CynyYXEKQi8/gAcc_thumb%5B1%5D.jpg?imgmax=800" width="527" height="228" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Go to google account settings&lt;/li&gt;    &lt;li&gt;In Security ,”Change authorized websites”&lt;/li&gt;    &lt;li&gt;Revoke the access from “stapi.snacktools.com”&lt;/li&gt;    &lt;li&gt;Switch to old orkut, until google had a fix over it.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Happy Social Networking!!!!!!!!!!!!!!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4252626994189221784?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4252626994189221784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4252626994189221784&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4252626994189221784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4252626994189221784'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2010/09/bom-sabado-worm-fix-for-orkut.html' title='Bom Sabado Worm Fix for Orkut'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_hLPHcFodaYU/TJ7-HS7pryI/AAAAAAAAAIk/CynyYXEKQi8/s72-c/gAcc_thumb%5B1%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5577925333508845220</id><published>2010-07-04T03:55:00.001-07:00</published><updated>2010-07-04T03:57:38.589-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IIS 7'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>HTTP Error 500.19 with IIS 7.0</title><content type='html'>&lt;p&gt;Last week i was deploying an application in IIS 7.0 freshly configured and got a HTTP 500.19 error as elaborated below &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Description:&lt;/b&gt; The requested page cannot be accessed because the related configuration data for the page is invalid. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Error Code:&lt;/b&gt; 0x80070021 &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Notification:&lt;/b&gt; BeginRequest &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Module:&lt;/b&gt; IIS Web Core &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Requested URL:&lt;/b&gt; &lt;a href="http://localhost:4341/webapplication1"&gt;http://localhost:4341/webapplication1&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Physical Path:&lt;/b&gt; c:\inetpub\wwwroot\webapplication1 &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Logon User:&lt;/b&gt; Not yet determined &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Logon Method:&lt;/b&gt; Not yet determined &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Handler:&lt;/b&gt; Not yet determined &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Config Error:&lt;/b&gt; This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault=&amp;quot;Deny&amp;quot;), or set explicitly by a location tag with overrideMode=&amp;quot;Deny&amp;quot; or the legacy allowOverride=&amp;quot;false&amp;quot;. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Config File:&lt;/b&gt; \\?\c:\inetpub\wwwroot\webapplication1 \web.config &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This due to the web.config section is get locked. By default whenever we install ASP.NET this section will be get unlocked. But sometime if we install IIS after ASP.NET installation it will not get unlocked. Here is the appcmd to unlock the section&lt;/p&gt;  &lt;p&gt;%windir%\system32\inetsrv\appcmd unlock config -section:system.webServer/handlers&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;You need to run this command in Administrator mode, also go to control panel-&amp;gt; Turn windows feature on or off and under IIS install ASP.net.&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5577925333508845220?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5577925333508845220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5577925333508845220&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5577925333508845220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5577925333508845220'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2010/07/http-error-50019-with-iis-70.html' title='HTTP Error 500.19 with IIS 7.0'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-6483238571935084629</id><published>2010-06-08T00:04:00.000-07:00</published><updated>2010-06-08T00:25:00.745-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Native Code'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Mobile'/><title type='text'>Windows Phone 7: No Native Code Support</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_hLPHcFodaYU/TA3vmg7fWhI/AAAAAAAAAIE/vQ9UDkvQ5bU/s1600/Microsoft-Windows-Phone-7-Adobe-Flash.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 263px;" src="http://1.bp.blogspot.com/_hLPHcFodaYU/TA3vmg7fWhI/AAAAAAAAAIE/vQ9UDkvQ5bU/s320/Microsoft-Windows-Phone-7-Adobe-Flash.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5480299766533282322" /&gt;&lt;/a&gt;&lt;br /&gt; As in the previous generations of Windows Mobile phones the newly arrived Windows Phone 7 does not have any Native Code(Native code is computer programming (code) that is compiled to run with a particular processor (such as an Intel x86-class processor) and its set of instructions) support.It will support application running in the RIA platform Silverlight runtime and XNA Game studio only. This will make most of the SmartPhone Application developers to refrain from the Windows Phone 7. The user interface overlay the .&lt;a href="http://www.microsoft.com/windowsembedded/en-us/products/windowsce/default.mspx"&gt;Windows Embedded CE 6.0 Release 3 kernel&lt;/a&gt; , runs only interpreted or managed code through the two runtime environments provided by Silverlight and XNA.  &lt;br /&gt;&lt;br /&gt; Eventually all the Silverlight developers will become windows mobile developers. Any way that's the new step to the mobile-RIA world, good gaming&lt;br /&gt;platform for the windows mobile with minimum hardware requirements&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-6483238571935084629?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/6483238571935084629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=6483238571935084629&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6483238571935084629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6483238571935084629'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2010/06/windows-phone-7-no-native-code-support.html' title='Windows Phone 7: No Native Code Support'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hLPHcFodaYU/TA3vmg7fWhI/AAAAAAAAAIE/vQ9UDkvQ5bU/s72-c/Microsoft-Windows-Phone-7-Adobe-Flash.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5275443953681572917</id><published>2010-05-08T02:29:00.001-07:00</published><updated>2010-05-09T22:33:49.718-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VS 2010'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>VS 2010 –Some amazing features</title><content type='html'>&lt;p&gt;For the past some months I'm looking into what’s there will be with Visual Studio 2010.At its beta releases VS 2010 faced a series of problems(Installer crash,Add reference empty in Silverlight project, Smart device project creation problem). Now they fixed most of the issues in the latest releases.I’m describing some of the cool new features with 2010 IDE.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;View Call Hierarchy&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;By this we can see the hierarchical list of function usage.We can see the parameter details and function location.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_hLPHcFodaYU/S-UuigEgHkI/AAAAAAAAAG0/zgzGQPed5TI/s1600-h/Untitled113.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Untitled11" border="0" alt="Untitled11" src="http://lh6.ggpht.com/_hLPHcFodaYU/S-Uuk08xWVI/AAAAAAAAAG4/roblURSlfb4/Untitled11_thumb1.jpg?imgmax=800" width="521" height="262" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Data &amp;amp; Schema Comparer&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Previously most of us struggle a lot in comparing data's and schemas in and between databases. Also there was some third party tools Sql tool belt from Redgate, its so expensive.In Visual Studio 2010(I'm using vs 2010 ultimate) there is a new schema and data comparison tool.You can select two different databases and run the comparison task.&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="651"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="477"&gt;&lt;a href="http://lh3.ggpht.com/_hLPHcFodaYU/S-UulpJHhMI/AAAAAAAAAG8/fHZXwy9FQWU/s1600-h/DMenu4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="DMenu" border="0" alt="DMenu" src="http://lh5.ggpht.com/_hLPHcFodaYU/S-UunT86h5I/AAAAAAAAAHA/LEemNyzPxUk/DMenu_thumb2.png?imgmax=800" width="386" height="125" /&gt;&lt;/a&gt;&amp;#160; &lt;/td&gt;        &lt;td valign="top" width="172"&gt;&lt;a href="http://lh4.ggpht.com/_hLPHcFodaYU/S-UuoY-hM0I/AAAAAAAAAHE/Wb0Xi6n9ruE/s1600-h/Capture4.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Capture" border="0" alt="Capture" src="http://lh4.ggpht.com/_hLPHcFodaYU/S-UupVxVs4I/AAAAAAAAAHI/Y6jpXkr8hmU/Capture_thumb2.jpg?imgmax=800" width="101" height="118" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_hLPHcFodaYU/S-UurhhGUfI/AAAAAAAAAH0/aJi7O3cb0Uo/s1600-h/Dcompare%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Dcompare" border="0" alt="Dcompare" src="http://lh6.ggpht.com/_hLPHcFodaYU/S-UutbpPIHI/AAAAAAAAAH8/dGN8FRfhEgs/Dcompare_thumb%5B3%5D.png?imgmax=800" width="418" height="248" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Architectural and UML Model Explorer&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is quite useful for functional &amp;amp; architect.In the tool bat Select-&amp;gt;Architecture-&amp;gt;Windows-&amp;gt;Architecture Explorer.Dig into it and do more!!!&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="600"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="300"&gt;&lt;a href="http://lh3.ggpht.com/_hLPHcFodaYU/S-UuuXLYNYI/AAAAAAAAAHU/J30obzKGAV8/s1600-h/archmen4.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="archmen" border="0" alt="archmen" src="http://lh4.ggpht.com/_hLPHcFodaYU/S-UuvJ9SUbI/AAAAAAAAAHY/yaMN0oXxOEQ/archmen_thumb2.jpg?imgmax=800" width="314" height="135" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td valign="top" width="300"&gt;&lt;a href="http://lh5.ggpht.com/_hLPHcFodaYU/S-UuwPcLBnI/AAAAAAAAAHc/OcwwgM8MDrE/s1600-h/Arch18.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Arch1" border="0" alt="Arch1" src="http://lh5.ggpht.com/_hLPHcFodaYU/S-UuxK3rMJI/AAAAAAAAAHg/Vwr0MD04XqA/Arch1_thumb6.jpg?imgmax=800" width="240" height="120" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Debugging With IntelliTrace&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Visual Studio 2010 had a vast changes in the debugging sections.One of the cool feature is “IntelliTrace” which will more helpful while debugging the application as it provide a detailed picture of the debug info , you can record debug information and we can later look up into the previous debug info.&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="600"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="250"&gt;         &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_hLPHcFodaYU/S-UuzI3Ve_I/AAAAAAAAAHk/8xyluxspLhI/s1600-h/intellitrace7.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="intellitrace" border="0" alt="intellitrace" src="http://lh3.ggpht.com/_hLPHcFodaYU/S-Uu0fCYPBI/AAAAAAAAAHo/44mxrfGmIQk/intellitrace_thumb3.jpg?imgmax=800" width="240" height="173" /&gt;&lt;/a&gt; &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="350"&gt;         &lt;p&gt;With IntelliTrace, you can actually see events that occurred in the past and the context in which they occurred. This reduces the number of restarts that are required to debug your application and the possibility that an error will fail to reproduce when you rerun the application.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Also we can pin-in values to variables&amp;#160; while debugging!!!&lt;/p&gt;  &lt;p&gt;Read more in MSDN &lt;a href="http://msdn.microsoft.com/en-us/library/dd264915.aspx" target="_blank"&gt;Click here&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Read more about debugging information on ScottGu Blog &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/04/21/vs-2010-debugger-improvements-breakpoints-datatips-import-export.aspx" target="_blank"&gt;Click here&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Also VS 2010 newly added&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Optional &amp;amp; Named parameters(like old vb 6) &lt;/li&gt;    &lt;li&gt;Insert Code Snippet for JS,Html &lt;/li&gt;    &lt;li&gt;We drag windows outside the model-Multi monitor support(Like we drag a tab to another window in Firefox&amp;amp;chrome)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_hLPHcFodaYU/S-Uu1SpUtrI/AAAAAAAAAHs/OF1dVD83ITE/s1600-h/Drag13.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Drag" border="0" alt="Drag" src="http://lh5.ggpht.com/_hLPHcFodaYU/S-Uu2zyIOyI/AAAAAAAAAHw/8VtB-WxTjQM/Drag_thumb11.jpg?imgmax=800" width="244" height="166" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;And many more…that i will update in this chain.&lt;/p&gt;  &lt;p&gt;Go and Rocks with VS 2010!!!!!!!!!!!!!!! &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5275443953681572917?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5275443953681572917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5275443953681572917&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5275443953681572917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5275443953681572917'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2010/05/vs-2010-some-amazing-features.html' title='VS 2010 –Some amazing features'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_hLPHcFodaYU/S-Uuk08xWVI/AAAAAAAAAG4/roblURSlfb4/s72-c/Untitled11_thumb1.jpg?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-3842987519270208424</id><published>2010-05-08T02:26:00.001-07:00</published><updated>2010-05-08T03:30:54.288-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Converting “Var” to Dataset</title><content type='html'>&lt;p&gt;After a long time back i’m into my blog…Didn’t get enough time to sit with the things..&lt;/p&gt; &lt;p&gt;In some cases we need to convert the anonymous datatype var to a dataset or datatable.we cant do it directly as so.Here is a &lt;/p&gt; &lt;p&gt;Simple method that will return the var or List item to dataset&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;   public static DataSet ToDataSet&lt;T&gt;(List&lt;T&gt; list)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        Type type = typeof(T);&lt;br /&gt;        DataSet ds = new DataSet("Company");&lt;br /&gt;        DataTable dt = new DataTable("Contacts");&lt;br /&gt;        ds.Tables.Add(dt);&lt;br /&gt;        //Dynamically adding columns to data table&lt;br /&gt;        foreach (var propInfo in type.GetProperties())&lt;br /&gt;        {&lt;br /&gt;            dt.Columns.Add(propInfo.Name, propInfo.PropertyType);&lt;br /&gt;&lt;br /&gt;            //You can add columns manually also here&lt;br /&gt;            if (propInfo.Name == "ID")&lt;br /&gt;            {&lt;br /&gt;                dt.Columns.Add("Photo");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        foreach (T item in list)&lt;br /&gt;        {&lt;br /&gt;            DataRow dr = dt.NewRow();&lt;br /&gt;            foreach (var propInfo in type.GetProperties())&lt;br /&gt;            {&lt;br /&gt;                dr[propInfo.Name] = propInfo.GetValue(item, null);&lt;br /&gt;            } &lt;br /&gt;            dt.Rows.Add(dr);&lt;br /&gt;        }&lt;br /&gt;        return ds;&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-3842987519270208424?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/3842987519270208424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=3842987519270208424&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3842987519270208424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3842987519270208424'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2010/05/converting-var-to-dataset.html' title='Converting “Var” to Dataset'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-3697322996418932334</id><published>2010-02-17T09:40:00.000-08:00</published><updated>2010-02-20T04:46:01.823-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Linq'/><title type='text'>Xml Manipulation Using Linq-Some basic lessons</title><content type='html'>The “functional construction”  feature of Linq to Xml provides great usability in creating and modifying xml documents. XDocument object is used for the xml declarations. The XElement class constructor are used in resolving the xml entities.&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;string path = Server.MapPath(@"/Linq2XML/DataStore.xml");&lt;br /&gt;        XDocument xd = XDocument.Load(path);&lt;br /&gt;        var result = from c in xd.Elements("DataStore").Elements("Table") select new { oid = (string)c.Element("oid"), BuildName = (string)c.Element("BuildName"), Appserver = (string)c.Element("Appserver"), DBServerName = (string)c.Element("DBServerName"), dbname = (string)c.Element("DBName"), comments = (string)c.Element("comments") };&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This will load the Xml file to your XDocument object and  perform a linq operation to get the xml elements. We can use Descendants to return the filtered collection of matching XName elements.&lt;br /&gt;&lt;br /&gt;For modifying the elements we can use the SetElementValue Method of XElement, that will set, add and remove child elements.&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;public void ModifyEnvironments(string oid,string buildName,string appServer,string dbServer,string dbName,string comments )&lt;br /&gt;    {&lt;br /&gt;        XDocument objdoc = XDocument.Load(HttpContext.Current.Server.MapPath(@"\Envdetails\DataStore.xml"));&lt;br /&gt;        var items = from item in objdoc.Descendants("Table")&lt;br /&gt;                    where item.Element("oid").Value == oid&lt;br /&gt;                    select item;&lt;br /&gt;        foreach (XElement itemElement in items)&lt;br /&gt;        {&lt;br /&gt;            itemElement.SetElementValue("BuildName", buildName);&lt;br /&gt;            itemElement.SetElementValue("Appserver", appServer);&lt;br /&gt;            itemElement.SetElementValue("DBServerName", dbServer);&lt;br /&gt;            itemElement.SetElementValue("DBName", dbName);&lt;br /&gt;            itemElement.SetElementValue("comments", comments);          &lt;br /&gt;        }&lt;br /&gt;        objdoc.Save(HttpContext.Current.Server.MapPath(@"\Linq2XML\DataStore.xml"));&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We can use Remove() to delete an element.Also can use RemoveContent  method that will make an empty element tag(&lt;tables/&gt;)&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt; public void DeleteEnvironment(string oid)&lt;br /&gt;&lt;br /&gt;    {&lt;br /&gt;        XDocument objdoc = XDocument.Load(HttpContext.Current.Server.MapPath(@"\Linq2XML\DataStore.xml"));&lt;br /&gt;        var items = (from item in objdoc.Descendants(@"Table")&lt;br /&gt;                     where item.Element("oid").Value == oid&lt;br /&gt;                     select item).FirstOrDefault();&lt;br /&gt;        items.Remove();     &lt;br /&gt;        objdoc.Save(HttpContext.Current.Server.MapPath(@"\Envdetails\DataStore.xml"));&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;For adding new XElement  we can use the Add() method&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;    public void AddEnvironments(string buildName, string appServer, string dbServer, string dbName, string comments)&lt;br /&gt;    {&lt;br /&gt;        XDocument objdoc = XDocument.Load(HttpContext.Current.Server.MapPath(@"\Envdetails\DataStore.xml"));&lt;br /&gt;        XElement xe = objdoc.Descendants("DataStore").Last();&lt;br /&gt;        xe.Add(new XElement("Table", new XElement("oid", GetMaxOid()), new XElement("BuildName", buildName)&lt;br /&gt;            ,new XElement("Appserver",appServer),new XElement("DBServerName",dbServer),new XElement("DBName",dbName),&lt;br /&gt;            new XElement("comments",comments)));&lt;br /&gt;        objdoc.Save(HttpContext.Current.Server.MapPath(@"\Linq2XML\DataStore.xml")); &lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Please find the sample XML file (“DataStore.xml”)&lt;a href="http://renjucool.com/blogfiles/datastore.xml"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-3697322996418932334?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/3697322996418932334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=3697322996418932334&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3697322996418932334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3697322996418932334'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2010/02/xml-manipulation-using-linq-some-basic.html' title='Xml Manipulation Using Linq-Some basic lessons'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5055361362811748249</id><published>2010-02-02T09:49:00.000-08:00</published><updated>2010-02-02T09:57:37.507-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows 7'/><category scheme='http://www.blogger.com/atom/ns#' term='GPS'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Location and Sensor Platform in Windows 7</title><content type='html'>Cool , there are some nice sets of Location and Sensor API associated with windows 7.As now computers are portable like cellular phone the necessity of GPS enabled application are very useful. If your laptop doesn’t have any sensors installed it will take the default location provided by the user. This  Location and sensor API open wide variety of applications.&lt;br /&gt; &lt;br /&gt;References&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd318936(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/dd318936(VS.85).aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd464636(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/dd464636(VS.85).aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Learn how to read the GPS co-ordinates, See this article.&lt;br /&gt;&lt;a href="http://blogs.msdn.com/coding4fun/archive/2006/10/31/912287.aspx"&gt;http://blogs.msdn.com/coding4fun/archive/2006/10/31/912287.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.c-sharpcorner.com/uploadfile/scottlysle/readgps09052007011539am/readgps.aspx"&gt;Even More..&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5055361362811748249?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5055361362811748249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5055361362811748249&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5055361362811748249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5055361362811748249'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2010/02/location-and-sensor-platform-in-windows.html' title='Location and Sensor Platform in Windows 7'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-7388357951251610629</id><published>2010-01-14T08:24:00.001-08:00</published><updated>2010-01-24T04:00:43.132-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Func&lt;T,TResults&gt; – Flexible delegate to create reusable functions</title><content type='html'>&lt;p&gt;Today while googling i found an interesting feature of delegate Func&amp;lt;T,TResults&amp;gt; ,it allows us to represent a method that can be passed as a parameter without declaring a custom delegate explicitly and the method must have one parameter that is passed to it by value and must return a value.&lt;/p&gt;  &lt;p&gt;In the following example we need to explicitly define a new delegate and assign a named method to it.&lt;/p&gt; &lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Text;&lt;br /&gt;namespace BlogSamples&lt;br /&gt;{&lt;br /&gt;    delegate int ConvertMethod(int _x);&lt;br /&gt;    class Program&lt;br /&gt;    {&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;            ConvertMethod objConv = SquareMe;&lt;br /&gt;            int val = 5;&lt;br /&gt;            //delegate is called&lt;br /&gt;            Console.WriteLine(objConv(val));&lt;br /&gt;            Console.ReadKey();&lt;br /&gt;        }&lt;br /&gt;        private static int SquareMe(int myInt)&lt;br /&gt;        {&lt;br /&gt;            return myInt * myInt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Without explicitly defining a new delegate it can be simplified as below&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Text;&lt;br /&gt;namespace BlogSamples&lt;br /&gt;{&lt;br /&gt;    class Program&lt;br /&gt;    {&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;            Func&lt;int,int&gt; convertMethod = SquareMe;&lt;br /&gt;            int val = 6;&lt;br /&gt;            Console.WriteLine(convertMethod(val));&lt;br /&gt;            Console.ReadKey();&lt;br /&gt;        }&lt;br /&gt;        private static int SquareMe(int myInt)&lt;br /&gt;        {&lt;br /&gt;            return myInt * myInt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt; &lt;p&gt;Please see the &lt;a href="http://msdn.microsoft.com/en-us/library/bb549151.aspx" target="_blank"&gt;msdn&lt;/a&gt; link for more references.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-7388357951251610629?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/7388357951251610629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=7388357951251610629&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7388357951251610629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7388357951251610629'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2010/01/func-flexible-delegate-to-create.html' title='Func&amp;lt;T,TResults&amp;gt; – Flexible delegate to create reusable functions'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-3867637437215170322</id><published>2009-12-19T22:34:00.000-08:00</published><updated>2009-12-19T22:53:34.985-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Restoring backup of Partitioned Database in sql server 2008</title><content type='html'>If we need to restore a database having some 'n' number of partition its very tedious to give all the partitioned filegroup to restore into a particular location in the database server.The below example we demonstrate to perform the task.Run the script in the master database.&lt;br /&gt;&lt;pre class="sql" name="code"&gt;&lt;br /&gt;IF Exists (SELECT '1' from sysobjects where name = 'RESTOREBKP_2008' and type ='p')&lt;br /&gt;BEGIN&lt;br /&gt;DROP PROCEDURE dbo.RESTOREBKP_2008&lt;br /&gt;END&lt;br /&gt;GO&lt;br /&gt;CREATE PROCEDURE RESTOREBKP_2008&lt;br /&gt;(&lt;br /&gt;@DBName varchar(max), -- DATABASENAME&lt;br /&gt;@BackupPath varchar(max), -- BACKUPFILEPATH&lt;br /&gt;@Path varchar(max) -- PHYSICALPATH&lt;br /&gt;)&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;--Variables declaration&lt;br /&gt;@ResFilesOnly Nvarchar(max),&lt;br /&gt;@ResQuery Nvarchar(max),&lt;br /&gt;@STR AS nVARCHAR(MAX),&lt;br /&gt;@Logicalname as nvarchar(max),&lt;br /&gt;@physicalname as nvarchar(max)&lt;br /&gt;&lt;br /&gt;--- LOOP Variable&lt;br /&gt;DECLARE @I AS INT, @J AS INT&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;set @ResFilesOnly='RESTORE FILELISTONLY&lt;br /&gt;FROM DISK = '''@BackupPath''''&lt;br /&gt;&lt;br /&gt;set @I = 1&lt;br /&gt;&lt;br /&gt;DECLARE @RESTORE AS TABLE(&lt;br /&gt;LogicalName nvarchar(128), PhysicalName nvarchar(500), Type char(1), FileGroupName nvarchar(128),&lt;br /&gt;Size numeric(20,0), MaxSize numeric(38,0), FileID bigint, CreateLSN numeric(38,0),&lt;br /&gt;DropLSN numeric(25,0) NULL, UniqueID uniqueidentifier, ReadOnlyLSN numeric(25,0) NULL,&lt;br /&gt;ReadWriteLSN numeric(25,0) NULL, BackupSizeInBytes bigint, SourceBlockSize int,&lt;br /&gt;FileGroupID int, LogGroupGUID uniqueidentifier NULL, DifferentialBaseLSN numeric(38,0) NULL,&lt;br /&gt;DifferentialBaseGUID uniqueidentifier, IsReadOnly bit, IsPresent bit,TDEThumbprint varchar(500)&lt;br /&gt;)&lt;br /&gt;INSERT INTO @RESTORE&lt;br /&gt;EXEC sp_executesql @ResFilesOnly&lt;br /&gt;&lt;br /&gt;SELECT @J = MAX(FILEID) FROM @RESTORE&lt;br /&gt;SET @STR = ''&lt;br /&gt;WHILE @I &lt;= @J&lt;br /&gt;BEGIN&lt;br /&gt;SELECT&lt;br /&gt;@Logicalname = LTRIM(RTRIM(Logicalname)), @physicalname = LTRIM(RTRIM(REVERSE(LEFT(REVERSE(physicalname),CHARINDEX('\',REVERSE(physicalname))-1))))&lt;br /&gt;FROM&lt;br /&gt;@RESTORE&lt;br /&gt;WHERE&lt;br /&gt;FILEID = @I&lt;br /&gt;SET @STR = @STR + 'MOVE N''' + @Logicalname + ''' TO N''' + @Path + @physicalname + ''', '&lt;br /&gt;&lt;br /&gt;SET @I = @I + 1&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;--Restore Backup Query&lt;br /&gt;set @ResQuery = 'RESTORE DATABASE ' + @dbname + ' FROM DISK = '''+ @BackupPath + ''' WITH '+ @STR +&lt;br /&gt;N' NOUNLOAD, STATS = 10'&lt;br /&gt;&lt;br /&gt;EXECUTE SP_EXECUTESQL @ResQuery&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Execute this Stored Procedure in your master database as given below&lt;br /&gt;&lt;br /&gt;EXEC RESTOREBKP_2008 '&lt;DbName&gt;', '&lt;backup path&gt;', '&lt;DbPath&gt;'&lt;br /&gt;&lt;br /&gt;Note:-In case of any clarification please mail me to mail@renjucool.com&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;See this article in MSDN by me&lt;/strong&gt; &lt;a href="http://code.msdn.microsoft.com/Sql2008PartionedDb"&gt;http://code.msdn.microsoft.com/Sql2008PartionedDb&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-3867637437215170322?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/3867637437215170322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=3867637437215170322&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3867637437215170322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3867637437215170322'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/12/restoring-backup-of-partitioned.html' title='Restoring backup of Partitioned Database in sql server 2008'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-706776077149576120</id><published>2009-12-16T10:56:00.001-08:00</published><updated>2009-12-16T10:57:42.039-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><title type='text'>Sql Server Reporting Service –Silverlight enabled</title><content type='html'>&lt;blockquote&gt;   &lt;p&gt;For sometime before i’m thinking of the reports(SSRS/CR) to be enabled by silverlight technologies, so after googling i found out a amazing tool from &lt;a href="http://www.perpetuumsoft.com/Silverlight-Viewer-for-Reporting-Services.aspx" target="_blank"&gt;perpetuumsoft&lt;/a&gt; to display SSRS reports in RIA enabled UI can do a deep zoom!!!!.Seems rocking!!!!&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-706776077149576120?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/706776077149576120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=706776077149576120&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/706776077149576120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/706776077149576120'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/12/sql-server-reporting-service.html' title='Sql Server Reporting Service –Silverlight enabled'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-6980524006584568388</id><published>2009-12-16T10:41:00.001-08:00</published><updated>2009-12-16T10:58:11.533-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='Links'/><title type='text'>Debugging for Silverlight</title><content type='html'>&lt;blockquote&gt;   &lt;p&gt;Find out the RIA platform silverlight debugging tool from MSFT,&lt;a href="http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx" target="_blank"&gt;whdc&lt;/a&gt;. also see this blog regarding the memory leak problem in silverlight.&lt;/p&gt;    &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/delay/archive/2009/03/11/where-s-your-leak-at-using-windbg-sos-and-gcroot-to-diagnose-a-net-memory-leak.aspx" target="_blank"&gt;http://blogs.msdn.com/delay/archive/2009/03/11/where-s-your-leak-at-using-windbg-sos-and-gcroot-to-diagnose-a-net-memory-leak.aspx&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-6980524006584568388?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/6980524006584568388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=6980524006584568388&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6980524006584568388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6980524006584568388'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/12/debugging-for-silverlight.html' title='Debugging for Silverlight'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2373315330060185147</id><published>2009-12-04T05:09:00.000-08:00</published><updated>2009-12-11T10:51:50.273-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Table Comparison in Sql Server</title><content type='html'>&lt;DIV&gt;&lt;FONT size=2&gt;&lt;FONT face=Tahoma&gt;SQL Server is having a command line tool  (TableDiff) to compare the data in two tables.It will perform the following  task.&lt;br /&gt;&lt;br /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/FONT&gt; &lt;OL&gt;   &lt;LI&gt;&lt;FONT size=2 face=Tahoma&gt;A row by row comparison between a source table in    an instance of Microsoft SQL Server acting as a replication Publisher and the    destination table at one or more instances of SQL Server acting as replication    Subscribers.&lt;br /&gt;&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Tahoma&gt;Perform a fast comparison by only comparing row    counts and schema.&lt;br /&gt;&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Tahoma&gt;Perform column-level comparisons.&lt;br /&gt;&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Tahoma&gt;Generate a Transact-SQL script to fix    discrepancies at the destination server to bring the source and destination    tables into convergence.&lt;br /&gt;&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Tahoma&gt;Log results to an output file or into a table in    the destination database.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;FONT size=2&gt; &lt;DIV&gt;&lt;FONT face=Tahoma&gt;eg:&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT face=Tahoma&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT face=Tahoma&gt;&amp;nbsp;"C:\Program Files\Microsoft SQL  Server\90\COM\TableDiff.exe" -sourceserver "&lt;EM&gt;SERVERNAME&lt;/EM&gt;" -sourcedatabase  "&lt;EM&gt;DBNAME&lt;/EM&gt;" -sourceschema "dbo" -sourcetable "&lt;EM&gt;SOURCETABLE1&lt;/EM&gt;"  -sourceuser "sa" -sourcepassword "&lt;EM&gt;PASSWORD&lt;/EM&gt;" -destinationserver  "&lt;EM&gt;SERVERNAME&lt;/EM&gt;" -destinationdatabase "&lt;EM&gt;DBNAME&lt;/EM&gt;" -destinationschema  "dbo" -destinationtable "&lt;EM&gt;SOURCETABLE2&lt;/EM&gt;" -destinationuser "sa"  -destinationpassword "&lt;EM&gt;PASSWORD&lt;/EM&gt;" -dt -o "C:\Documents and  Settings\renjuraj\My Documents\diff.xls" &lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT face=Tahoma&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT face=Tahoma&gt;Run the above command in command prompt.Please refer your  sql server installation path(C:\Program Files\Microsoft SQL  Server\90\COM\TableDiff.exe).&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;br /&gt;&lt;/DIV&gt;&lt;/FONT&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2373315330060185147?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2373315330060185147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2373315330060185147&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2373315330060185147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2373315330060185147'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/12/table-comparison-in-sql-server.html' title='Table Comparison in Sql Server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2381676145966181104</id><published>2009-12-03T10:23:00.001-08:00</published><updated>2009-12-11T10:52:59.260-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows 7'/><title type='text'>Windows 7 Startup Animation Design</title><content type='html'>&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:66721397-FF69-4ca6-AEC4-17E6B3208830:e3a10f34-9f9e-4aa1-98ba-8ad017d40c49" class="wlWriterEditableSmartContent"&gt;&lt;a style="border:0px" href="http://cid-7a1a083b3f3567e6.skydrive.live.com/redir.aspx?page=browse&amp;amp;resid=7A1A083B3F3567E6!122&amp;amp;ct=photos"&gt;&lt;img style="border:0px" alt="View Win7" src="http://lh5.ggpht.com/_hLPHcFodaYU/SxgCL-d9YBI/AAAAAAAAAGk/e6j_AD9VMd0/InlineRepresentation5085377e-b8ea-4560-8fbb-3658f420ab55.jpg?imgmax=800" /&gt;&lt;/a&gt;&lt;div style="width:400px;text-align:right;" &gt;&lt;a href="http://cid-7a1a083b3f3567e6.skydrive.live.com/redir.aspx?page=browse&amp;amp;resid=7A1A083B3F3567E6!122&amp;amp;ct=photos"&gt;View Full Album&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;Rolf Ebeling, a senior user experience lead for the User Experience Design and Research Team for Windows, Windows Live, and Internet Explorer, is the man who designed the 105-frame Windows 7 boot animation that millions see or will see every day for years to come. Along with developing the famous boot animation, he also helped with the appearance and functionality of the calculator. He's already confirmed that he'll be working on the next version of Windows. Ebeling was only with the company for four months before he was asked to start designing what would become four swirling balls of light that come together to form a pulsing Windows 7 flag. Although the sketches of the early boot animation concept pictured above don't show it, Ebeling said he looked everywhere for inspiration, including street lights in the rain, light reflecting off water, and fireflies. A self-taught designer with a degree in English literature, Ebeling was a creative director for Newsweek.com in New York before joining Microsoft in April 2008, his first software job. &lt;/p&gt;  &lt;p&gt;Source :Microsoft&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2381676145966181104?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2381676145966181104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2381676145966181104&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2381676145966181104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2381676145966181104'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/12/windows-7-startup-animation-design.html' title='Windows 7 Startup Animation Design'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_hLPHcFodaYU/SxgCL-d9YBI/AAAAAAAAAGk/e6j_AD9VMd0/s72-c/InlineRepresentation5085377e-b8ea-4560-8fbb-3658f420ab55.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-203261651740131797</id><published>2009-11-22T23:14:00.000-08:00</published><updated>2009-11-23T10:17:16.259-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance Tunning'/><title type='text'>Longest Running Procedures in Sql Server</title><content type='html'>Its useful to determine which SProc/Code have the greatest impact on the Server. Sometimes, that is determined by examining the I/O cost,sometimes by the Exectution Duration.  In this eg, Total Impact is determined by examining the length of execution and the frequency of execution.&lt;br /&gt;&lt;pre class="sql" name="code"&gt;&lt;br /&gt;SELECT TOP 10 &lt;br /&gt; temp.text as ProcedureName, &lt;br /&gt; s.execution_count as ExecutionCount, &lt;br /&gt; isnull( s.total_elapsed_time / s.execution_count, 0 ) as AvgExecutionTime, &lt;br /&gt; s.total_worker_time / s.execution_count as AvgWorkerTime, &lt;br /&gt; s.total_worker_time as TotalWorkerTime, &lt;br /&gt; s.max_logical_reads as MaxLogicalReads, &lt;br /&gt; s.max_logical_writes as MaxLogicalWrites, &lt;br /&gt; s.creation_time as CreationDateTime, &lt;br /&gt; s.total_physical_reads as PhysicalReads,&lt;br /&gt; isnull( s.execution_count / datediff( second, s.creation_time,getdate()), 0 )as CallsPerSecond&lt;br /&gt;FROM sys.dm_exec_query_stats s &lt;br /&gt;CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) temp &lt;br /&gt;ORDER BY &lt;br /&gt;-- s.total_elapsed_time DESC &lt;br /&gt;s.execution_count desc&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-203261651740131797?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/203261651740131797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=203261651740131797&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/203261651740131797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/203261651740131797'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/11/longest-running-procedures-in-sql.html' title='Longest Running Procedures in Sql Server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4790190430698074546</id><published>2009-11-19T22:40:00.000-08:00</published><updated>2009-12-11T10:52:20.267-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Transaction Log growing in Sql Server</title><content type='html'>&lt;DIV&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=2&gt;&lt;SPAN  class=881105505-20112009&gt;T&lt;/SPAN&gt;ransaction log in SQL Server is one of the most  important parts of a SQL Server , as well as one of the most common generators  of problems I see online&lt;SPAN class=881105505-20112009&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT  size=2&gt;The following are the causes for transaction log  growth,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;1.Due to Uncommitted transactions. We can  find if there are any open transactions using &lt;EM&gt;DBCC OPENTRAN&lt;/EM&gt;.  &lt;BR&gt;2.Running DBCC REINDEX, CREATE INDEX operations with the database in Full  Recovery model. &lt;BR&gt;3.Running extremely large transactions like Bulk Insert,  Select Into commands.&lt;BR&gt;&lt;/FONT&gt;&lt;A  href="http://support.microsoft.com/kb/317375/"&gt;&lt;FONT  face=Verdana&gt;http://support.microsoft.com/kb/317375/&lt;/FONT&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;The following are the proactive measures in order  to minimize the unexpected log file growth,&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;1.If you do not want point in time recovery of  your databases then you can change the recovery model to Simple. &lt;BR&gt;2.Set the  size of the transaction log files to a large value to avoid the automatic  expansion of the transaction log files. &lt;BR&gt;3.Configure the automatic expansion  of transaction log in terms of MB instead of %. &lt;BR&gt;4.Backup the transaction log  regularly to delete the inactive transactions in your transaction log if you are  using full or bulk logged recovery model. &lt;BR&gt;5.You can switch the recovery  model to Bulk logged from full recovery model if you perform some bulk inserts,  select into, bcp, alter index, create index commands because these operations  will be minimally logged in bulk logged recovery model and after those  operations are completed you can switch over to full recovery  model.&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;BR&gt;&lt;STRONG&gt;&lt;FONT size=2  face=Verdana&gt;Solutions&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;STRONG&gt;&lt;/STRONG&gt; &lt;OL&gt;   &lt;LI&gt;&lt;FONT size=2 face=Verdana&gt;Take full backup of your database &lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Verdana&gt;Take t-log backup of your database frequently    say every 30 or 15 minutes so that log file will not grow drastically    &lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Verdana&gt;Shrink if you do not have any free space. You    can perform this operation manually if required.&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Verdana&gt;Generally avoid shrinking the database and keep    it as the last option.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;If you are in full recovery, then no it won't be  truncated.run the following command:&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;EM&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;P&gt;&lt;FONT size=2 face=Verdana&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT  face=Verdana&gt; &lt;FONT color=#ff00ff&gt;&lt;FONT  color=#ff00ff&gt;DATABASEPROPERTYEX&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT  color=#808080&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;&lt;FONT  color=#ff0000&gt;'Lorenzo347'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT  color=#808080&gt;,&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color=#ff0000&gt;&lt;FONT  color=#ff0000&gt;'RECOVERY'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT  color=#808080&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT size=2&gt;&lt;FONT  size=2&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;If it returns FULL or BULK_LOGGED, then you will  have to backup the log, either to disk or specifying the truncate only to get it  truncate the space off.&amp;nbsp; If you do that, then you might as well change your  recovery model to SIMPLE and be done with this problem.&amp;nbsp; If it says you are  already in SIMPLE, then it should shrink without problem.&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT face=Verdana&gt;backup&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff  size=2&gt;&lt;FONT color=#ff00ff size=2&gt;log&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT  color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT  size=2&gt;your &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff  size=2&gt;database&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; name&lt;/FONT&gt;&lt;FONT color=#808080  size=2&gt;&lt;FONT color=#808080 size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT  color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;with&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;  truncate_only &lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;STRONG&gt;&lt;FONT size=2 face=Verdana&gt;Shrink Log files&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt; &lt;DL&gt;   &lt;DD&gt;&lt;FONT size=2 face=Verdana&gt;DECLARE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT    face=Verdana&gt; @LogFileName &lt;FONT color=#0000ff&gt;&lt;FONT    color=#0000ff&gt;varchar&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT    color=#808080&gt;(&lt;/FONT&gt;&lt;/FONT&gt;100&lt;FONT color=#808080&gt;&lt;FONT    color=#808080&gt;)&lt;/DD&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT    color=#0000ff&gt;   &lt;DD&gt;&lt;FONT size=2 face=Verdana&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT    face=Verdana&gt; @LogFileName &lt;FONT color=#808080&gt;&lt;FONT    color=#808080&gt;=&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color=#ff00ff&gt;&lt;FONT    color=#ff00ff&gt;rtrim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080&gt;&lt;FONT    color=#808080&gt;(&lt;/FONT&gt;&lt;/FONT&gt;name&lt;FONT color=#808080&gt;&lt;FONT    color=#808080&gt;)&lt;/DD&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT    color=#0000ff&gt;   &lt;DD&gt;&lt;FONT size=2 face=Verdana&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT    face=Verdana&gt; dbo&lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    color=#008000&gt;&lt;FONT    color=#008000&gt;sysfiles&lt;/DD&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    color=#0000ff&gt;&lt;FONT color=#0000ff&gt;   &lt;DD&gt;&lt;FONT size=2 face=Verdana&gt;WHERE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT    face=Verdana&gt; Name &lt;FONT color=#808080&gt;&lt;FONT color=#808080&gt;like&lt;/FONT&gt;&lt;/FONT&gt;    &lt;FONT color=#ff0000&gt;&lt;FONT    color=#ff0000&gt;'%_log%'&lt;/DD&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;   &lt;DD&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;FONT color=#0000ff&gt;&lt;FONT    color=#0000ff&gt;dbcc&lt;/FONT&gt;&lt;/FONT&gt; SHRINKFILE&lt;FONT color=#808080&gt;&lt;FONT    color=#808080&gt;(&lt;/FONT&gt;&lt;/FONT&gt;@LogFileName&lt;FONT color=#808080&gt;&lt;FONT    color=#808080&gt;,&lt;/FONT&gt;&lt;/FONT&gt; 2&lt;FONT color=#808080&gt;&lt;FONT    color=#808080&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DD&gt;&lt;/DL&gt; &lt;P&gt;&lt;SPAN class=881105505-20112009&gt;&lt;FONT color=#808080 size=2  face=Verdana&gt;Shrinks the log file&amp;nbsp; to 2 MB&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR&gt;&lt;A  href="http://msdn.microsoft.com/en-us/library/aa258824(SQL.80).aspx"&gt;&lt;FONT  size=2  face=Verdana&gt;http://msdn.microsoft.com/en-us/library/aa258824(SQL.80).aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/DIV&gt; &lt;DIV align=left&gt; &lt;TABLE border=0 cellSpacing=0 cellPadding=0 width="100%" align=left&gt;   &lt;TBODY&gt;   &lt;TR&gt;     &lt;TD&gt;&lt;FONT face=Verdana&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;FONT        size=2&gt;&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;SPAN        class=881105505-20112009&gt;&lt;FONT        color=#ff0000&gt;Note:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2        face=Verdana&gt;&lt;EM&gt;Detaching and deleting the log is definitely not        advisable&amp;nbsp; &lt;BR&gt;&amp;nbsp;At best it forces you to take your database        offline. Worst case is that you invalidate your entire database and have        to&amp;nbsp;&amp;nbsp;restore from backup.&lt;/EM&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;   &lt;TR&gt;     &lt;TD&gt;&lt;FONT face=Verdana&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;   &lt;TR&gt;     &lt;TD&gt;&lt;FONT face=Verdana&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;   &lt;TR&gt;     &lt;TD&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Verdana&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4790190430698074546?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4790190430698074546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4790190430698074546&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4790190430698074546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4790190430698074546'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/11/transaction-log-growing-in-sql-server.html' title='Transaction Log growing in Sql Server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4939743056717723090</id><published>2009-11-15T22:49:00.001-08:00</published><updated>2009-11-18T11:11:34.593-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance Tunning'/><title type='text'>Index to be recreated in Sql Server</title><content type='html'>When your database grows, the index fragmentation becomes too high,that will scale down the performance of the sql server. To overcome that we need to re-build the index, that should be done at the down time of the server.Here there is a query that will list all the index to be recreated/rebuild.It uses the following tables(sys.indexes,sys.tables,sys.schemas,sys.dm_db_index_physical_stats,sys.partitions). For detailed checkup change the last NULL in the dm_db_index_physical_stats call to &amp;#39;SAMPLED&amp;#39; or even &amp;#39;DETAILED&amp;#39;&lt;br /&gt;&lt;br /&gt;&lt;pre class="sql" name="code"&gt;&lt;br /&gt;SELECT 'ALTER INDEX [' + ix.name + '] ON [' + s.name + '].[' + t.name +'] ' +&lt;br /&gt;CASE WHEN ps.avg_fragmentation_in_percent &gt; 40 THEN 'REBUILD'&lt;br /&gt;ELSE 'REORGANIZE' END +&lt;br /&gt;CASE WHEN pc.partition_count &gt; 1 THEN ' PARTITION = ' +&lt;br /&gt;cast(ps.partition_number as nvarchar(max)) ELSE '' END&lt;br /&gt;FROM sys.indexes AS ix INNER JOIN sys.tables t&lt;br /&gt;ON t.object_id = ix.object_id&lt;br /&gt;INNER JOIN sys.schemas s&lt;br /&gt;ON t.schema_id = s.schema_id&lt;br /&gt;INNER JOIN (SELECT object_id, index_id,avg_fragmentation_in_percent, partition_number&lt;br /&gt;FROM sys.dm_db_index_physical_stats (DB_ID(), NULL,NULL, NULL, NULL)) ps&lt;br /&gt;ON t.object_id = ps.object_id AND ix.index_id = ps.index_id&lt;br /&gt;INNER JOIN (SELECT object_id, index_id, COUNT(DISTINCT&lt;br /&gt;partition_number) AS partition_count&lt;br /&gt;FROM sys.partitions&lt;br /&gt;GROUP BY object_id, index_id) pc&lt;br /&gt;ON t.object_id = pc.object_id AND ix.index_id = pc.index_id&lt;br /&gt;WHERE ps.avg_fragmentation_in_percent &gt; 10 AND&lt;br /&gt;ix.name IS NOT NULL&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4939743056717723090?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4939743056717723090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4939743056717723090&amp;isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4939743056717723090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4939743056717723090'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/11/index-to-be-recreated-in-sql-server.html' title='Index to be recreated in Sql Server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2626940117400097375</id><published>2009-11-09T11:07:00.000-08:00</published><updated>2009-11-09T11:12:04.304-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VS 2010'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>VS 2010 Tranining kit</title><content type='html'>MSFT released the training kit(october preview) of VS 2010 framework.Can download it from Microsoft website.The Beta 2 release of the Training Kit contains 15 presentations, 19 hands-on labs, and 13 demos. Many technologies are covered in this release, including: C# 4, VB 10, F#, Parallel Extensions, Windows Communication Foundation, Windows Workflow, Windows Presentation Foundation, ASP.NET 4, Entity Framework, ADO.NET Data Services, Managed Extensibility Framework, and Visual Studio Ultim&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=752CB725-969B-4732-A383-ED5740F02E93&amp;displaylang=en"&gt;Click here to dowload from Microsoft&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2626940117400097375?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2626940117400097375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2626940117400097375&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2626940117400097375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2626940117400097375'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/11/vs-2010-tranining-kit.html' title='VS 2010 Tranining kit'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2561206404009386605</id><published>2009-10-28T06:16:00.001-07:00</published><updated>2009-11-01T03:00:15.027-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Linq'/><title type='text'>Getting Country List from CultureInfo</title><content type='html'>We can use CultureInfo to get the list of countries/languages.Today i got a method to list all the countries, even it has some duplicate values that are elimated by a distinct linq query.&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;public void CountryList()&lt;br /&gt;{&lt;br /&gt;ArrayList cList=new ArrayList();&lt;br /&gt;foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures &amp; ~CultureTypes.NeutralCultures))&lt;br /&gt;{&lt;br /&gt;RegionInfo ri = new RegionInfo(ci.LCID);&lt;br /&gt;cList.Add(ri.EnglishName);&lt;br /&gt;}&lt;br /&gt;var countries = cList.ToArray();&lt;br /&gt;var i = (from temp in countries select temp).Distinct().OrderBy(s=&gt;s);&lt;br /&gt;foreach (var item in i)&lt;br /&gt;{&lt;br /&gt;listBox1.Items.Add(item.ToString()); &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Also an interesting thing with Textinfo to make the first letter of a string/sentence to capital.(Little bit tricky :-))&lt;br /&gt;&lt;br /&gt;string temp = "MULTIDIMENSIONAL NEWTON RAPHSON";&lt;br /&gt;string firstSmall = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(temp.ToLower()); //I made a trick to make the string to lower case&lt;br /&gt;MessageBox.Show(firstSmall.ToString());&lt;br /&gt;&lt;br /&gt;Output :Multidimensional Newton Raphson&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2561206404009386605?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2561206404009386605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2561206404009386605&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2561206404009386605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2561206404009386605'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/getting-country-list-from-cultureinfo.html' title='Getting Country List from CultureInfo'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-8974485968212046935</id><published>2009-10-27T04:52:00.000-07:00</published><updated>2009-10-28T11:32:21.723-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Workstation &amp; Server Garbage Collector</title><content type='html'>There are two types of garbage collector,the workstation GC and Server GC.Workstation is the default on client versions of windows,but server is much faster on multicore machines.The Server GC utilize more memory&lt;br /&gt;&lt;pre name="code" class="xml"&gt;  &lt;br /&gt;&lt;p&gt;&amp;lt;configuration&amp;gt;  &amp;lt;runtime&amp;gt;    &lt;br&gt; &amp;lt;gcServer enabled=&amp;quot;true&amp;quot;/&amp;gt; &lt;br&gt; &amp;lt;/runtime&amp;gt;&lt;br&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Note:All sample code is provided is for illustrative purposes only.These examples have not been thoroughly tested under all conditions.Myself, therefore, cannot guarantee or imply reliability,serviceability, or function of these programs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-8974485968212046935?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/8974485968212046935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=8974485968212046935&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/8974485968212046935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/8974485968212046935'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/workstation-server-garbage-collector.html' title='Workstation &amp; Server Garbage Collector'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-1382919130889316451</id><published>2009-10-25T11:24:00.000-07:00</published><updated>2009-10-25T11:46:03.467-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Bugs in Sql Server</title><content type='html'>Today i got noticed a bug in sql server 2005(also in SSMS 08) while executing a simple select statement&lt;br /&gt; &lt;br /&gt;select 3 --(*) &lt;br /&gt;&lt;br /&gt;Msg 102, Level 15, State 1, Line 1&lt;br /&gt;&lt;br /&gt;Incorrect syntax near '--(*'.&lt;br /&gt;&lt;br /&gt;If we put a space or any other characters before the "(" there is no error. Also &lt;br /&gt;select 3 --)*  not returning error.Any way this is a bug in sql server as it does not parse the comment statements&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_hLPHcFodaYU/SuSchPd3f9I/AAAAAAAAAGU/Z-iIpWT5H7k/s1600-h/untitled.bmp"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 195px;" src="http://2.bp.blogspot.com/_hLPHcFodaYU/SuSchPd3f9I/AAAAAAAAAGU/Z-iIpWT5H7k/s320/untitled.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5396610348398116818" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also i got an error message while Parsing an sql script as&lt;br /&gt;&lt;br /&gt;&lt;em&gt;."Net SqlClient Data Provider: Msg 0, Level 11, State 0, Line 0&lt;br /&gt;A severe error occurred on the current command. The results, if any, should be discarded."&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;But the script is executing successfully and giving the accurate results!!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-1382919130889316451?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/1382919130889316451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=1382919130889316451&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/1382919130889316451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/1382919130889316451'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/bugs-in-sql-server.html' title='Bugs in Sql Server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hLPHcFodaYU/SuSchPd3f9I/AAAAAAAAAGU/Z-iIpWT5H7k/s72-c/untitled.bmp' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2882082318470335127</id><published>2009-10-14T05:30:00.001-07:00</published><updated>2009-11-04T10:51:49.397-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Last modified Db User Objects &amp; Tables without Trigger in Sql server</title><content type='html'>If you need to check the details of all DB User Objects by Last Modified Date try the following query&lt;BR&gt; &lt;br /&gt;&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;EM&gt;select&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT size=2&gt; name&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; modify_date&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;case&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;when&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; type_desc &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'USER_TABLE'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;EM&gt;then&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Table'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;when&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; type_desc &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'SQL_STORED_PROCEDURE'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Stored Procedure'&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;EM&gt;when&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT size=2&gt; type_desc &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'SQL_INLINE_TABLE_VALUED_FUNCTION'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'SQL_SCALAR_FUNCTION'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'SQL_TABLE_VALUED_FUNCTION'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;EM&gt;then&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Function'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; type_desc &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;from&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;sys&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;objects&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;where&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;type&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'U'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'P'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'FN'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'IF'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'TF'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)and&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; is_ms_shipped &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; 0&lt;BR&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;EM&gt;order&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; 2 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;desc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt; &lt;EM&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&amp;nbsp;&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT size=2&gt; &lt;FONT color=#0c0c0c&gt;Find the below query that will list &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0c0c0c&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;all&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;U&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;tables&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; without &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;triggers&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;sql&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;server&lt;/FONT&gt;&lt;/FONT&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;This &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;is&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; helpful &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;when&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; someone &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;modify&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; the &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;table&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;FONT color=#0c0c0c&gt;make sure that there aren&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0c0c0c&gt;&lt;FONT color=#0c0c0c&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;'t any tables that have triggers on them so that stuff doesn'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;t start &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;to&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;break&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;after&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; you make &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0c0c0c&gt;changes.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt; &lt;FONT color=#0c0c0c&gt;&lt;FONT color=#0c0c0c&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0c0c0c&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;BR&gt;&lt;FONT color=#0c0c0c&gt;&lt;FONT color=#0c0c0c&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;EM&gt;SELECT&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT color=#000000 size=2&gt; ob1&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;name &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;sysobjects&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; ob1 &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;LEFT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;JOIN&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;sysobjects&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; ob2 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;ON&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;BR&gt; &lt;EM&gt;ob1&lt;/EM&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;id &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;ob2&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;parent_obj &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;AND&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; ob2&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;xtype &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'TR'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;EM&gt;WHERE&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT color=#000000 size=2&gt; ob2&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;name &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;IS&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;NULL&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;AND&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; ob1&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;xtype &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'U'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; &lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;EM&gt;ORDER&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT color=#000000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;BY&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; ob1&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;name&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2882082318470335127?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2882082318470335127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2882082318470335127&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2882082318470335127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2882082318470335127'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/last-modified-db-user-objects-tables.html' title='Last modified Db User Objects &amp; Tables without Trigger in Sql server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-8875148852581838605</id><published>2009-10-14T04:19:00.000-07:00</published><updated>2009-10-28T10:08:37.921-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>ELMAH (Error Logging Modules and Handlers)</title><content type='html'>HTTP modules and handlers can be used in ASP.NET to provide a high degree of componentization for code that is orthogonal to a web application, enabling entire sets of functionalities to be developed,packaged and deployed as a single unit and independent of an application. ELMAH (Error Logging Modules and Handlers) illustrates this approach by demonstration of an application-wide error logging that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine,without any need for re-compilation or re-deployment.The end-user(if allows) can view the exception/inner exception logged in the server,Its description and even the screen-shot of the&lt;br /&gt;error page&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It can be downloaded from &lt;br&gt;&lt;a href="http://code.google.com/p/elmah/"&gt;http://code.google.com/p/elmah/&lt;/a&gt;&lt;br&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa479332.aspx"&gt;http://msdn2.microsoft.com/en-us/library/aa479332.aspx&lt;/a&gt;&lt;br&gt;&lt;a href="http://download.microsoft.com/download/E/9/7/E97DB6A9-3418-46DF-99CA-840&lt;br /&gt;357FE4D72/MSDNElmah.msi"&gt;http://download.microsoft.com/download/E/9/7/E97DB6A9-3418-46DF-99CA-840&lt;br&gt;357FE4D72/MSDNElmah.msi&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-8875148852581838605?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/8875148852581838605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=8875148852581838605&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/8875148852581838605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/8875148852581838605'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/elmah-error-logging-modules-and.html' title='ELMAH (Error Logging Modules and Handlers)'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-6785956298025735074</id><published>2009-10-12T21:38:00.001-07:00</published><updated>2009-10-13T11:28:27.958-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Using spt_values to generate junk datas</title><content type='html'>master..spt_values can be used if you need to populate a table with 100 numbers from 1,or if you need to generate some Junk/Test data.Refer the query below that will generate data of various datatypes&lt;br /&gt; &lt;br /&gt;select&lt;br /&gt;abs(checksum(newid()))%10000 as n_id,&lt;br /&gt;abs(checksum(newid()))*rand()/10000 as f_float,&lt;br /&gt;substring(replace(cast(newid() as varchar(36)),'-',''),1,abs(checksum(newid()))%15) as s_string,&lt;br /&gt;dateadd(day,0,abs(checksum(newid()))%100000) as d_date,&lt;br /&gt;abs(checksum(newid()))%2 as b_byte&lt;br /&gt;from master..spt_values&lt;br /&gt;where type='p' and number between 1 and 200&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_hLPHcFodaYU/StTE1N8nabI/AAAAAAAAAGE/AtPWpEgRgaA/s1600-h/spt_values.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 214px;" src="http://2.bp.blogspot.com/_hLPHcFodaYU/StTE1N8nabI/AAAAAAAAAGE/AtPWpEgRgaA/s320/spt_values.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5392151072425339314" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-6785956298025735074?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/6785956298025735074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=6785956298025735074&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6785956298025735074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6785956298025735074'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/using-sptvalues-to-generate-junk-datas.html' title='Using spt_values to generate junk datas'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hLPHcFodaYU/StTE1N8nabI/AAAAAAAAAGE/AtPWpEgRgaA/s72-c/spt_values.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-3193513528994832745</id><published>2009-10-12T04:25:00.001-07:00</published><updated>2009-10-13T11:36:14.953-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Getting all reference of an Assembly</title><content type='html'>&lt;FONT size=2&gt; To get the assembly reference in a ASP.NET web application i found a recursive method that will read from the csproject file.&lt;BR&gt; Import these namespace also &lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;BR&gt; using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; System.Xml.Linq;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;BR&gt; &lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; LoadAssembly(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; path)&lt;BR&gt; {&lt;BR&gt; &lt;BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; result=0;&lt;BR&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;XNamespace&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; msbuild = &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"http://schemas.microsoft.com/developer/msbuild/2003"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;;&lt;BR&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;XDocument&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; projDefinition = &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;XDocument&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Load(path);&lt;BR&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;IEnumerable&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; references = projDefinition.Element(msbuild + &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"Project"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt; .Elements(msbuild + &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"ItemGroup"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt; .Elements(msbuild + &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"Reference"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt; .Elements(msbuild + &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;"Name"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;BR&gt; .Select(refElem =&amp;gt; refElem.Value);&lt;BR&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;foreach&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; reference &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;in&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; references)&lt;BR&gt; {&lt;BR&gt; &lt;BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr&gt; &lt;P dir=ltr&gt;richTextBox1.AppendText(reference);&lt;/P&gt; &lt;P style="MARGIN-RIGHT: 0px" dir=ltr&gt;richTextBox1.AppendText(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;Environment&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.NewLine);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;BR&gt; }&lt;BR&gt; &amp;nbsp;&lt;BR&gt; If you need to loop through the IEnumerable iterator to find out other xml nodes u can use the following&lt;BR&gt; &amp;nbsp;&lt;BR&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; (&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;&lt;FONT color=#2b91af size=2&gt;IEnumerator&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;gt; enumerator = references.GetEnumerator())&lt;BR&gt; {&lt;BR&gt; &lt;BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;while&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; (enumerator.MoveNext())&lt;BR&gt; result++;&lt;BR&gt;&lt;/BLOCKQUOTE&gt; }&lt;BR&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; (result == 0)&lt;BR&gt; {&lt;BR&gt; &lt;BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr&gt; //Do ur xml operations&lt;BR&gt;&lt;/BLOCKQUOTE&gt; &lt;BR&gt; }&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://blog.renjucool.com/"&gt;&lt;/A&gt;            &lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-3193513528994832745?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/3193513528994832745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=3193513528994832745&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3193513528994832745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3193513528994832745'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/getting-all-reference-of-assembly.html' title='Getting all reference of an Assembly'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5727512165303613385</id><published>2009-10-11T23:52:00.001-07:00</published><updated>2009-10-14T09:53:18.066-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Trigger to monitor the entire database server</title><content type='html'>&lt;BR&gt; Please find this trigger script to monitor the entire database activities and to log its records into audit tables.&lt;BR&gt; It will work on Sql Server 2008.&lt;BR&gt; &amp;nbsp;&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; USE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; [master]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt; -------Create table -------------------------&lt;BR&gt; -- DROP TABLE AuditTrigger&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; CREATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;TABLE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; [dbo]&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;[AuditTrigger]&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; [OID] [bigint] &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;IDENTITY&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;1&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;1&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;NOT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;NULL,&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; [Details] [varchar]&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;max&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;NULL,&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; [Host] [varchar]&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;20&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;NULL&lt;BR&gt; )&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; GO&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt; -----Create proc to insert into AuditTrigger table&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; IF&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;EXISTS(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; 1 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt;sysobjects&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;where&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; name &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'PInsertAuditTrigger'&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; BEGIN&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;DROP&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;PROCEDURE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; PInsertAuditTrigger&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; END&lt;BR&gt; GO&lt;BR&gt; CREATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;PROC&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; PInsertAuditTrigger&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;varchar&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;max&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@hostname &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;VARCHAR&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;MAX&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;))&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; AS&lt;BR&gt; BEGIN&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;INSERT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;INTO&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;master&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;dbo&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;AuditTrigger&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;DETAILS&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;HOST&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @DETAILS&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@HOSTNAME&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; END&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt; -------- Trigger to monitor tables&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; GO&lt;BR&gt; CREATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;TRIGGER&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; [Table_Trigger]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; ON&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;ALL&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;SERVER&lt;BR&gt; FOR&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; create_table&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;alter_table&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;drop_table&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; AS&lt;BR&gt; BEGIN&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;print&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Create/Alter table is not allowed - '&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;+&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;host_name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;()&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;rollback&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;DECLARE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @host_name &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;varchar&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;max&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;varchar&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;max&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @host_name &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;Host_name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Create/Alter table'&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;exec&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; dbo&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;PInsertAuditTrigger&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@host_name &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; END&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt; -------- Trigger to monitor procedures&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; GO&lt;BR&gt; CREATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;TRIGGER&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; [Proc_Trigger]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; ON&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;ALL&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;SERVER&lt;BR&gt; FOR&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; create_procedure&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;alter_procedure&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;drop_procedure&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; AS&lt;BR&gt; BEGIN&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;print&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Create/Alter procedure is not allowed - '&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;+&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;host_name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;()&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;rollback&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;DECLARE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @host_name &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;varchar&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;max&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;varchar&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;max&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @host_name &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;Host_name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Create/Alter procedure'&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;exec&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; dbo&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;PInsertAuditTrigger&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@host_name &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; END&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000 size=2&gt; -------- Trigger to monitor login,roles and database&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; GO&lt;BR&gt; CREATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;TRIGGER&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; [Misc_Trigger]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; ON&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;ALL&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;SERVER&lt;BR&gt; FOR&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; Create_role&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;drop_role&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;alter_role&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;create_database&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;drop_database&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;alter_database&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;create_view&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;alter_view&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;drop_view&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;create_login&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;drop_login&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; AS&lt;BR&gt; BEGIN&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;print&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Illegal operation is not allowed - '&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;+&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;host_name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;()&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;rollback&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;DECLARE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @host_name &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;varchar&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;max&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;varchar&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;max&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @host_name &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff size=2&gt;Host_name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(),&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Illegal operation'&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;exec&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; dbo&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;PInsertAuditTrigger&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@Details&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;,&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;@host_name &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt; END&lt;BR&gt; GO&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5727512165303613385?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5727512165303613385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5727512165303613385&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5727512165303613385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5727512165303613385'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/trigger-to-monitor-entire-database.html' title='Trigger to monitor the entire database server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5084214026001280676</id><published>2009-10-09T02:04:00.001-07:00</published><updated>2009-10-12T10:51:18.103-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='T-SQL Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Removing all active connections from the db</title><content type='html'>&lt;FONT size=2 face=Arial&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff  size=2&gt; &lt;DL dir=ltr&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;FONT    face=Verdana&gt;&lt;EM&gt;Use&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;&lt;FONT    size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff    size=2&gt;Master&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DT&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff    size=2&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;Go&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DT&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;FONT    face=Verdana&gt;&lt;EM&gt;Declare&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2    face=Verdana&gt;&lt;EM&gt; @dbname &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT    color=#0000ff size=2&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;sysname&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DT&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;FONT    face=Verdana&gt;&lt;EM&gt;Set&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;&lt;FONT    size=2&gt; @dbname &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080    size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT    color=#ff0000 size=2&gt;'DBNAME'&lt;/DIV&gt;&lt;/DT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT  size=2&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;&lt;FONT    color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Declare&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt; @spid &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff    size=2&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT    color=#0000ff size=2&gt;Select&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @spid &lt;/FONT&gt;&lt;FONT    color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;    &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT color=#ff00ff    size=2&gt;min&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080    size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;spid&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT    color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff    size=2&gt;&lt;FONT color=#0000ff size=2&gt;from&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT    color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;master&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt;dbo&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080    size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&lt;FONT color=#008000    size=2&gt;sysprocesses&lt;/DIV&gt;&lt;/DT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff    size=2&gt;&lt;FONT color=#0000ff size=2&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;FONT    face=Verdana&gt;&lt;EM&gt;where&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;&lt;FONT    size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff    size=2&gt;dbid&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT    color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff    size=2&gt;&lt;FONT color=#ff00ff size=2&gt;db_id&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080    size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt;@dbname&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080    size=2&gt;)&lt;/DIV&gt;&lt;/DT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT    color=#0000ff size=2&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;FONT    face=Verdana&gt;&lt;EM&gt;While&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;&lt;FONT    size=2&gt; @spid &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080    size=2&gt;Is&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT    color=#808080 size=2&gt;Not&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080    size=2&gt;&lt;FONT color=#808080 size=2&gt;Null&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT    color=#0000ff size=2&gt;&lt;FONT color=#0000ff    size=2&gt;Begin&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;    &lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DT&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;&lt;FONT    color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Execute &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    color=#ff0000 size=2&gt;&lt;FONT color=#ff0000 size=2&gt;'Kill '&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080    size=2&gt;+&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; @spid&lt;/FONT&gt;&lt;FONT color=#808080    size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DT&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;&lt;FONT    color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Select&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt; @spid &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080    size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff size=2&gt;&lt;FONT    color=#ff00ff size=2&gt;min&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT    color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;spid&lt;/FONT&gt;&lt;FONT    color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;    &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff    size=2&gt;from&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT    color=#0000ff size=2&gt;master&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT    color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;dbo&lt;/FONT&gt;&lt;FONT color=#808080    size=2&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008000    size=2&gt;&lt;FONT color=#008000 size=2&gt;sysprocesses&lt;/FONT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DT&gt;   &lt;DT&gt;   &lt;DIV style="MARGIN-RIGHT: 0px"&gt;&lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;EM&gt;&lt;FONT    color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;where&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff    size=2&gt;dbid&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT    color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff00ff    size=2&gt;&lt;FONT color=#ff00ff size=2&gt;db_id&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#808080    size=2&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt;@dbname&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#808080    size=2&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT    color=#808080 size=2&gt;and&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; spid &lt;/FONT&gt;&lt;FONT    color=#808080 size=2&gt;&lt;FONT color=#808080 size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT    size=2&gt; @spid&lt;/DIV&gt;&lt;/DT&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT    color=#0000ff size=2 face=Verdana&gt;   &lt;DT&gt;   &lt;DIV  style="MARGIN-RIGHT: 0px"&gt;&lt;EM&gt;End&lt;/EM&gt;&lt;/DIV&gt;&lt;/DT&gt;&lt;/DL&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5084214026001280676?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5084214026001280676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5084214026001280676&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5084214026001280676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5084214026001280676'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/removing-all-active-connections-from-db.html' title='Removing all active connections from the db'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-6072187521728311247</id><published>2009-10-08T09:41:00.000-07:00</published><updated>2009-10-08T10:06:50.005-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Sql Server 2008-Spacial Data</title><content type='html'>Microsoft SQL Server 2008 delivers comprehensive spatial support that enables organizations to seamlessly consume, use, and extend location-based data through spatial-enabled applications which ultimately helps end users make better decisions.storing Lat/Long data in a geography datatype and being able to calculate/query using the functions that go along with it.It supports both Planar and Geodetic data.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;•Use the new geography data type to store geodetic spatial data and perform operations on it&lt;br /&gt;&lt;br /&gt;•Use the new geometry data type to store planar spatial data and perform operations on it&lt;br /&gt;&lt;br /&gt;•Take advantage of new spatial indexes for high performance queries&lt;br /&gt;&lt;br /&gt;•Use the new spatial results tab to quickly and easily view spatial query results directly from within Management Studio &lt;br /&gt;&lt;br /&gt;•Extend spatial data capabilities by building or integrating location-enabled applications through support for spatial standards and specifications &lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_hLPHcFodaYU/Ss4ZN-zNmAI/AAAAAAAAAF8/CoLXq-Cs_Y0/s1600-h/att58249.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 167px;" src="http://1.bp.blogspot.com/_hLPHcFodaYU/Ss4ZN-zNmAI/AAAAAAAAAF8/CoLXq-Cs_Y0/s320/att58249.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5390273531995854850" /&gt;&lt;/a&gt;&lt;br /&gt; DECLARE @g GEOMETRY&lt;br /&gt;SET @g = 'LINESTRING (  69 26, 69 23, 69 21, 67 20, 65 20, &lt;br /&gt;          63 18, 58 17, 52 17, 51 17, 49 17, 45 18, 44 20, &lt;br /&gt;          44 21, 42 26, 42 29, 42 32, 42 35, 43 35, 47 38, &lt;br /&gt;          50 41, 55 42, 58 42, 65 44, 66 44, 67 44, 68 45, &lt;br /&gt;          69 47, 70 48, 70 50, 71 51, 70 56, 68 60, 68 63, &lt;br /&gt;          66 65, 65 66, 63 68, 60 71, 59 71, 57 71, 55 71, &lt;br /&gt;          51 69, 45 65, 44 63, 42 62, 41 59, 41 57, 41 56, &lt;br /&gt;          41 54, 42 53 ,67 77 ,44 88)'&lt;br /&gt;   insert into location values(2,'renju',null,@g);      &lt;br /&gt;   &lt;br /&gt; declare @p geometry  &lt;br /&gt; set @p=  'POLYGON ((30 30, 40 30, 40 40, 30 40, 30 30))' &lt;br /&gt;  insert into location values(3,'renju2',null,@p);     &lt;br /&gt;  &lt;br /&gt; http://www.microsoft.com/sqlserver/2008/en/us/spatial-data.aspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-6072187521728311247?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/6072187521728311247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=6072187521728311247&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6072187521728311247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6072187521728311247'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/sql-server-2008-spacial-data.html' title='Sql Server 2008-Spacial Data'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hLPHcFodaYU/Ss4ZN-zNmAI/AAAAAAAAAF8/CoLXq-Cs_Y0/s72-c/att58249.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-3161657456267505070</id><published>2009-10-07T23:24:00.000-07:00</published><updated>2009-10-08T09:40:06.630-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Sql Server Hidden Features - Part 2</title><content type='html'>&lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;A lot of SQL Server developers still don't seem to  know about the OUTPUT clause (SQL Server 2005 and newer) on the DELETE, INSERT  and UPDATE statement.&lt;BR&gt;It can be extremely useful to know which rows have been  INSERTed, UPDATEd, or DELETEd, and the OUTPUT clause allows to do this very  easily -&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;it allows access to the "virtual" tables called  inserted and deleted (like in triggers):&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;&lt;EM&gt;DELETE FROM (table)OUTPUT deleted.ID,  deleted.DescriptionWHERE (condition)&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;If you're inserting values into a table which has  an INT IDENTITY primary key field, with the OUTPUT clause, you can get the  inserted new ID right away:&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;&lt;BR&gt;&lt;EM&gt;INSERT INTO MyTable(Field1, Field2)OUTPUT  inserted.IDVALUES (Value1, Value2)&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;And if you're updating, it can be extremely useful  to know what changed - in this case, inserted represents the new values (after  the UPDATE), while deleted refers to the old values before the  UPDATE:&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;&lt;EM&gt;UPDATE (table)SET field1 = value1, field2 =  value2OUTPUT inserted.ID, deleted.field1, inserted.field1WHERE  (condition)&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;&lt;BR&gt;If a lot of info will be returned, the output  of OUTPUT can also be redirected to a temporary table or a table variable  (OUTPUT INTO @myInfoTable).&lt;/FONT&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt; &lt;DIV&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRONG&gt;More tips&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt; &lt;UL&gt;   &lt;LI&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;SPAN class=367280706-08102009&gt;U&lt;/SPAN&gt;se    &lt;EM&gt;ctrl-0&lt;/EM&gt; to insert a null value in a cell&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;&lt;EM&gt;WITH (FORCESEEK)&lt;/EM&gt; which forces the query    optimizer to use only an index seek operation as the access path to the data    in the table.&lt;BR&gt;&lt;/FONT&gt;&lt;A    href="http://msdn.microsoft.com/en-us/library/bb510478.aspx"&gt;&lt;FONT size=2    face=Arial&gt;http://msdn.microsoft.com/en-us/library/bb510478.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;PIVOT and UNPIVOT&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;Save transactions &lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;EM&gt;&lt;SPAN    class=367280706-08102009&gt;S&lt;/SPAN&gt;elect xact_state()&lt;/EM&gt;&amp;nbsp; --Returns    whether transaction pending/committed&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2    face=Arial&gt;&lt;EM&gt;xp_fixeddrives&lt;/EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;    --Returns the free disk space in the server&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;&lt;EM&gt;SELECT    ASCII('A'),CHAR(65),CHAR(ASCII('A')),UNICODE(N'?'),NCHAR(923),NCHAR(UNICODE(N'?'))&lt;/EM&gt;    --Some Ascii/unicode features&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;&lt;EM&gt;select * from tablename tablesample(2    percent)&lt;/EM&gt; --Returns the 2% of the records in the db.Alt select top 10    percent * from table &lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;&lt;EM&gt;select cast(GETDATE()as varchar) as    datetime&lt;/EM&gt; --Returns the date time as formatted.&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;&lt;EM&gt;WITH TIES&lt;BR&gt;&lt;/EM&gt;The SELECT TOP N query    always return exactly N records, and arbitrarily drops any record that have    the same value as the last record in the group&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;select top 5 with ties * from scores order by name    desc&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT size=2 face=Arial&gt;&lt;EM&gt;SELECT Column FROM Table ORDER BY    CHECKSUM(NEWID())&lt;/EM&gt; -- Return rows in a random order&lt;/FONT&gt;&lt;/LI&gt;   &lt;LI&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;   &lt;P&gt;&lt;FONT color=#000000 size=2 face=Arial&gt;master..xp_cmdshell to run commands    from a command prompt on the server &lt;BR&gt;master..xp_cmdshell 'dir    d:\'&amp;nbsp;&amp;nbsp; --List the Directory&lt;BR&gt;master..xp_cmdshell 'sc query    "ccm6.5_ess"' --Query a service&lt;BR&gt;master..xp_cmdshell 'sc start "ccm6.5_ess"'    --Start a service&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;   &lt;P&gt;&lt;FONT color=#ff0000 size=2&gt;&lt;FONT color=#ff0000    size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt; &lt;DIV align=left&gt; &lt;TABLE border=0 cellSpacing=0 cellPadding=0 width="100%" align=left&gt;   &lt;TBODY&gt;   &lt;TR&gt;     &lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;   &lt;TR&gt;     &lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;   &lt;TR&gt;     &lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;   &lt;TR&gt;     &lt;TD&gt;&lt;FONT size=2 face=Arial&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt; &lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-3161657456267505070?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/3161657456267505070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=3161657456267505070&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3161657456267505070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3161657456267505070'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/sql-server-hidden-features-part-2.html' title='Sql Server Hidden Features - Part 2'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4434465118095199422</id><published>2009-10-03T09:41:00.001-07:00</published><updated>2009-10-03T10:08:28.622-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Two free security tools from Microsoft SDL team</title><content type='html'>The SDL team here at Microsoft released a couple of new tools recently to help development teams verify the security of their software before they ship. &lt;a href="http://go.microsoft.com/?linkid=9678113"&gt;BinScope Binary Analyzer &lt;/a&gt;and &lt;a href="http://go.microsoft.com/?linkid=9678112"&gt;MiniFuzz File Fuzzer&lt;/a&gt; are both being offered as free downloads. The team took the time to make sure that both tools work as stand-alone tools as well as integrated into Visual Studio and Team System.&lt;br /&gt;&lt;br /&gt;BinScope is a verification tool that has been used inside Microsoft for several years to help developers and testers confirm they are building their code to use compiler/linker protections required by the SDL. BinScope allows you to scan your code to verify you are setting important security protections such as /GS, /SafeSEH, /NXCOMPAT, and /DYNAMICBASE. In addition it checks to see that you are using .NET strong-named assemblies, good ATL headers, an up-to-date compiler, and not using dangerous constructs such as global function pointers. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_hLPHcFodaYU/SseBSstEdkI/AAAAAAAAAFs/dVDO9Gf648o/s1600-h/clip_image004_thumb.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 315px; height: 320px;" src="http://4.bp.blogspot.com/_hLPHcFodaYU/SseBSstEdkI/AAAAAAAAAFs/dVDO9Gf648o/s320/clip_image004_thumb.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5388417637409912386" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Both of these tools are equipped to easily integrate with Visual Studio 2008 Pro as well as Team Foundation Server 2008 and Team System 2008. By installing BinScope as integrated, it can be launched and output results within the Visual Studio IDE. MiniFuzz can be installed as an external tool add-in. Both tools have easy-to-set integration with Team Foundation Server 2008 and compliment the SDL Process Template for VSTS.&lt;br /&gt;&lt;br /&gt;Writing secure code is becoming very important to most development teams. I am glad to see the SDL team making these types of tools available to the Visual Studio development community and making it easier to ship more secure code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4434465118095199422?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4434465118095199422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4434465118095199422&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4434465118095199422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4434465118095199422'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/two-free-security-tools-from-microsoft.html' title='Two free security tools from Microsoft SDL team'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hLPHcFodaYU/SseBSstEdkI/AAAAAAAAAFs/dVDO9Gf648o/s72-c/clip_image004_thumb.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4889369530661285209</id><published>2009-10-03T01:22:00.000-07:00</published><updated>2009-10-03T01:52:44.266-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance Tunning'/><title type='text'>Sql Server Hidden Features</title><content type='html'>&lt;strong&gt;Stored Procedures&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;    * sp_msforeachtable: Runs a command with '?' replaced with each table name (v6.5 and up)&lt;br /&gt;    * sp_msforeachdb: Runs a command with '?' replaced with each database name (v7 and up)&lt;br /&gt;    * sp_who2: just like sp_who, but with a lot more info for troubleshooting blocks (v7 and up)&lt;br /&gt;    * sp_helptext: If you want the code of a stored procedure&lt;br /&gt;    * sp_tables: return a list of all tables&lt;br /&gt;    * sp_stored_procedures: return a list of all stored procedures&lt;br /&gt;    * xp_sscanf: Reads data from the string into the argument locations specified by each format argument.&lt;br /&gt;    * xp_fixeddrives:: Find the fixed drive with largest free space&lt;br /&gt;    * sp_help: If you want to know the table structure, indexes and constraints of a table&lt;br /&gt;&lt;strong&gt;Functions&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;    * HashBytes()&lt;br /&gt;    * EncryptByKey&lt;br /&gt;    * PIVOT command&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;TableDiff.exe&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;    * Table Difference tool allows you to discover and reconcile differences between a source and destination table or a view. Tablediff Utility can report differences on schema and data. The most popular feature of tablediff is the fact that it can generate a script that you can run on the destination that will reconcile differences between the tables.&lt;br /&gt;&lt;a href="http://technet.microsoft.com/hi-in/library/cc917696%28en-us%29.aspx"&gt;See More&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Return rows in a random order&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;SELECT &lt;br /&gt;    SomeColumn &lt;br /&gt;FROM &lt;br /&gt;    SomeTable&lt;br /&gt;ORDER BY &lt;br /&gt;    CHECKSUM(NEWID())&lt;br /&gt;&lt;br /&gt;In Management Studio, you can put a number after a GO end-of-batch marker to cause the batch to be repeated that number of times:&lt;br /&gt;&lt;br /&gt;PRINT 'X'&lt;br /&gt;GO 10&lt;br /&gt;&lt;br /&gt;Will print 'X' 10 times. This can save you from tedious copy/pasting when doing repetitive stuff&lt;br /&gt;&lt;br /&gt;Identity Coloumn Insert&lt;br /&gt;&lt;br /&gt;Last week i need a scenario to insert values into a table having an identity coloumn only.&lt;br /&gt;&lt;br /&gt;eg: create table test(id int identity)&lt;br /&gt;&lt;br /&gt;Is it possible to insert values into the without setting identity insert off/on.I find out a method as follows.&lt;br /&gt;&lt;br /&gt;insert into test() default values&lt;br /&gt;go 20&lt;br /&gt;&lt;br /&gt;This will insert 20 records to the table haaa...&lt;br /&gt;Will update later..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4889369530661285209?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4889369530661285209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4889369530661285209&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4889369530661285209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4889369530661285209'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/sql-server-hidden-features.html' title='Sql Server Hidden Features'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4729756170735764810</id><published>2009-10-02T20:01:00.000-07:00</published><updated>2009-10-02T20:17:29.515-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Google Wave: the sky is falling!!!</title><content type='html'>Google Wave is a product that helps users communicate and collaborate on the web. A "wave" is equal parts conversation and document, where users can almost instantly communicate and work together with richly formatted text, photos, videos, maps, and more. Google Wave is also a platform with a rich set of open APIs that allow developers to embed waves in other web services and to build extensions that work inside waves.&lt;br /&gt;&lt;br /&gt;A wave is equal parts conversation and document. People can communicate and work together with richly formatted text, photos, videos, maps, and more.&lt;br /&gt;&lt;br /&gt;A wave is shared. Any participant can reply anywhere in the message, edit the content and add participants at any point in the process. Then playback lets anyone rewind the wave to see who said what and when.&lt;br /&gt;&lt;br /&gt;A wave is live. With live transmission as you type, participants on a wave can have faster conversations, see edits and interact with extensions in real-time. &lt;br /&gt;&lt;br /&gt;So is Wave going to threaten RIA platforms?  I don’t know.  Is it even an RIA platform?  I just think that all the messages about how Wave is pushing out things like Flash, Silverlight or JavaFX are unfounded at this point.  They all serve purposes.I still requested for an invitation to join waves,but not yet received from google.One who got invites can invite 8 more people,if then so please invite me to mail@renjucool.com&lt;br /&gt;http://wave.google.com&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4729756170735764810?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4729756170735764810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4729756170735764810&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4729756170735764810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4729756170735764810'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/10/google-wave-sky-is-falling.html' title='Google Wave: the sky is falling!!!'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-745967778968094170</id><published>2009-08-20T11:09:00.000-07:00</published><updated>2009-08-20T11:15:14.546-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Game Consoles'/><title type='text'>Sony announces PS3 Slim for $299</title><content type='html'>Sony finally announced the much rumored PlayStation 3 Slim gaming console at the on-going GamesCom 2009 Expo in Cologne, Germany. Back in May, images of Sony PS3 Slim chasis and retail package were leaked. Sony Computer Entertainment CEO Kaz Hirai unveiled new PlayStation 3 Slim model at the GamesCon 2009 Expo.&lt;br /&gt;Sony will offer PS3 Slim in North America and Europe based stores from Sept. 1 for $299 (Rs. 14,400 approx.). The Sony PlayStation 3 Slim CECH-2000A features 120GB HDD and will come with PS3 firmware 3.0 version. Sony said it currently has no plans to bring PS3 Slim in India. Interestingly, PS3News folks dug up some information about another PS3 Slim CECH-2000B model with 250GB HDD from FCC site.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_hLPHcFodaYU/So2SML7n8GI/AAAAAAAAAEk/aY6cWp8jzZ0/s1600-h/105648_ps3-450.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 195px;" src="http://3.bp.blogspot.com/_hLPHcFodaYU/So2SML7n8GI/AAAAAAAAAEk/aY6cWp8jzZ0/s320/105648_ps3-450.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5372110668581826658" /&gt;&lt;/a&gt;&lt;br /&gt;Fat and huge looking Sony PS3 will shed weight and size in new PlayStation 3 Slim version that will pack 120GB storage. Sony has redesigned the internal design architecture of PS3 Slim - from main semiconductors to power supply unit. Hirai, at the launch, said that PS3 Slim is 33 percent smaller and 36 percent lighter than the previous PS3 models.&lt;br /&gt;&lt;br /&gt;PS3 Slim has new 45nm process manufactured Cell processor that runs at the same clock speed as the old 60nm processor. Obviously this smaller processor would be more power efficient and power consumption can be brought down by two-thirds which will reduce fan noise. Sony has designed PS3 Slim to be used horizontally (as PS2 is used) unlike the earlier PS3 models. However, Sony offers a $24 (Rs. 1,200 approx.) stand to hold the PS3 Slim vertically.&lt;br /&gt;&lt;br /&gt;Along with that, Sony has also slashed prices of the existing PS3 models by $100 (Rs. 4,800 approx.). So now, the 80GB HDD bearing PS3 will cost $299 (Rs. 14,400 approx.) and the 160GB HDD bearing PS3 will cost $399 (Rs. 19,200 approx.).&lt;br /&gt;&lt;br /&gt;The PlayStation 3 80 GB prices for India have been slashed by 20 percent and now the console costs Rs. 19,990. Along with that, Sony India will also offer two Free Games: Uncharted: Drake's Fortune and GT5 Prologue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-745967778968094170?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/745967778968094170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=745967778968094170&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/745967778968094170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/745967778968094170'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/08/sony-announces-ps3-slim-for-299.html' title='Sony announces PS3 Slim for $299'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hLPHcFodaYU/So2SML7n8GI/AAAAAAAAAEk/aY6cWp8jzZ0/s72-c/105648_ps3-450.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2095101642698159978</id><published>2009-08-15T05:11:00.000-07:00</published><updated>2009-08-15T05:23:01.650-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Others'/><title type='text'>Windows Azure Services Platform</title><content type='html'>Windows® Azure is a cloud services operating system that serves as the development, service hosting and service management environment for the Windows Azure Platform. Windows Azure provides developers with on-demand compute and storage to host, scale, and manage Web applications on the Internet through Microsoft® data centers.&lt;br /&gt;&lt;br /&gt;Windows Azure is currently in Community Technology Preview. Commercial availability for Windows Azure will likely be at the end of calendar year 2009.&lt;br /&gt;&lt;br /&gt;Windows Azure is an open platform that will support both Microsoft and non-Microsoft languages and environments. To build applications and services on Windows Azure, developers can use their existing Microsoft® Visual Studio® 2008 expertise. In addition, Windows Azure supports popular standards and protocols including SOAP, REST, XML, and PHP.&lt;br /&gt;&lt;br /&gt;We can use azure service for&lt;br /&gt;    * Add Web service capabilities to existing packaged applications&lt;br /&gt;    * Build, modify, and distribute applications to the Web with minimal on-premises resources&lt;br /&gt;    * Perform services (large-volume storage, batch processing, intense or large-      volume computations, etc.) off premises&lt;br /&gt;    * Create, test, debug, and distribute Web services quickly and inexpensively&lt;br /&gt;    * Reduce costs of building and extending on-premises resources&lt;br /&gt;    * Reduce the effort and costs of IT management&lt;br /&gt;&lt;br /&gt;On August 11,2009 we are releasing a new set of features for Windows Azure Blob. Windows Azure Blob enables applications to store and manipulate large objects and files in the cloud. The blobs (files) can be up to 50GB in size for the CTP.&lt;br /&gt;&lt;br /&gt;All changes for this release are versioned changes, using “x-ms-version: 2009-07-17”. All prior versions of commands executed against the storage system will continue to work, as we extend the capabilities of the existing commands and introduce new commands.&lt;br /&gt;http://www.microsoft.com/azure/netservices.mspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2095101642698159978?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2095101642698159978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2095101642698159978&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2095101642698159978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2095101642698159978'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/08/windows-azure-services-platform.html' title='Windows Azure Services Platform'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-171855904038006081</id><published>2009-08-15T04:25:00.000-07:00</published><updated>2009-08-15T04:51:27.825-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Silverlight and Deepzoom</title><content type='html'>Silverlight Deep Zoom provides the ability to view high resolution images rapidly without affecting the performance of your applications.&lt;br /&gt;This page from silverlight.net has some quick start tutorials for Silverlight Deep Zoom.&lt;br /&gt;http://memorabilia.hardrock.com/ has the best example for Silverlight Deep Zoom implementation.&lt;br /&gt;&lt;br /&gt;Above page has hundreds of high resolution images of Rock Bands. Below are screenshots of Silverlight Deep Zoom in action.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_hLPHcFodaYU/SoadNC3dqpI/AAAAAAAAADc/aWIspGIwGzA/s1600-h/1.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 198px;" src="http://2.bp.blogspot.com/_hLPHcFodaYU/SoadNC3dqpI/AAAAAAAAADc/aWIspGIwGzA/s320/1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370152453119257234" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I dont need to tell you who the guys are ;-)&lt;br /&gt;&lt;br /&gt;A little bit of zoom out!!!&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_hLPHcFodaYU/SoadYpS6sEI/AAAAAAAAADk/I2CkIEMN21c/s1600-h/2.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 201px;" src="http://1.bp.blogspot.com/_hLPHcFodaYU/SoadYpS6sEI/AAAAAAAAADk/I2CkIEMN21c/s320/2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370152652413513794" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Some more…&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_hLPHcFodaYU/SoadiRUtvJI/AAAAAAAAADs/yTd_E1gDHa4/s1600-h/3.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 199px;" src="http://3.bp.blogspot.com/_hLPHcFodaYU/SoadiRUtvJI/AAAAAAAAADs/yTd_E1gDHa4/s320/3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370152817777294482" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;more….&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_hLPHcFodaYU/SoadqR0353I/AAAAAAAAAD0/1VTfw6soLqk/s1600-h/4.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 202px;" src="http://1.bp.blogspot.com/_hLPHcFodaYU/SoadqR0353I/AAAAAAAAAD0/1VTfw6soLqk/s320/4.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370152955351132018" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Some more…&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_hLPHcFodaYU/Soad06qaBFI/AAAAAAAAAD8/pc549IzMFY4/s1600-h/5.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 198px;" src="http://2.bp.blogspot.com/_hLPHcFodaYU/Soad06qaBFI/AAAAAAAAAD8/pc549IzMFY4/s320/5.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370153138111775826" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Can you find the guys in the above picture? Let us zoom out some more..&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_hLPHcFodaYU/Soad_xxzojI/AAAAAAAAAEE/j8R1plL2R6M/s1600-h/6.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 198px;" src="http://3.bp.blogspot.com/_hLPHcFodaYU/Soad_xxzojI/AAAAAAAAAEE/j8R1plL2R6M/s320/6.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370153324705456690" /&gt;&lt;/a&gt;&lt;br /&gt;more…&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_hLPHcFodaYU/SoaeNXTRM6I/AAAAAAAAAEM/v5IpdE50Plc/s1600-h/7.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 200px;" src="http://3.bp.blogspot.com/_hLPHcFodaYU/SoaeNXTRM6I/AAAAAAAAAEM/v5IpdE50Plc/s320/7.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370153558116217762" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;some more???&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_hLPHcFodaYU/SoaeXVL273I/AAAAAAAAAEU/O8L9plDqp4Q/s1600-h/8.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 198px;" src="http://4.bp.blogspot.com/_hLPHcFodaYU/SoaeXVL273I/AAAAAAAAAEU/O8L9plDqp4Q/s320/8.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370153729346957170" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;hmmm!! some more??&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_hLPHcFodaYU/SoaemF2tQEI/AAAAAAAAAEc/8TDzsvbozqc/s1600-h/10.jpg"&gt;&lt;img style="float:None; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 194px;" src="http://2.bp.blogspot.com/_hLPHcFodaYU/SoaemF2tQEI/AAAAAAAAAEc/8TDzsvbozqc/s320/10.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370153982929748034" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is the beauty of Silverlight Deep Zoom. So next time when you send your large collection og your last picnic photos you dont have to send large attachments. Create a simple Silverlight site with Deep Zoom and send it with Style.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-171855904038006081?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/171855904038006081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=171855904038006081&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/171855904038006081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/171855904038006081'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/08/silverlight-and-deepzoom.html' title='Silverlight and Deepzoom'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hLPHcFodaYU/SoadNC3dqpI/AAAAAAAAADc/aWIspGIwGzA/s72-c/1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-6875193118290744203</id><published>2009-07-19T11:16:00.000-07:00</published><updated>2009-10-26T12:42:46.649-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Data Recovery/Live Software-ERD Commander</title><content type='html'>RD Commander is a very useful tool that Microsoft acquired with it’s purchase of Winternals. It’s especially useful for computers that aren’t able to boot into Windows, or even safe mode. ERD (Emergency Repair Disk) allows access to Windows restore points, file recovery, crash analysis, hotfix uninstall, and other low level operating system tasks, all in a very familiar Windows interface. It also provides network and internet access, as well as a web browser.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_hLPHcFodaYU/SmNklyIHbJI/AAAAAAAAADE/4IlMIOITayw/s1600-h/erd.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 239px;" src="http://4.bp.blogspot.com/_hLPHcFodaYU/SmNklyIHbJI/AAAAAAAAADE/4IlMIOITayw/s320/erd.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5360238581774773394" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The full version is intended for IT professionals, and is available only as part of the Microsoft Desktop Optimization Pack for Software Assurance customers. However, you can download a free-trial as part of the Microsoft Diagnostics and Recovery Toolset. After downloading this toolset, install it to find an ISO file containing ERD Commander:&lt;br /&gt;&lt;br /&gt;C:\Program Files\Microsoft Diagnostics and Recovery Toolset\erd50.iso&lt;br /&gt;&lt;br /&gt;An ISO is a special file that when burned to a CD can create a bootable CD. Windows doesn’t support ISO burning without third-party software. ISO Recorder is a very simple, and free program for creating CDs from ISOs. After you’ve burned the CD from the ISO, simply boot the system from the CD you just created to start ERD Commander. If your system doesn’t boot from the CD, you might have to change the BIOS boot settings (boot order).&lt;br /&gt;&lt;br /&gt;A couple of caveats. The trial version of ERD Commander is ERD Commander 2005. The latest version (currently ERD 6.0) is only shipping with the Desktop Optimization Pack. While version 6.0 is Vista compatible, 2005 is not (compatible with Windows NT, 2000, XP, and Server 2003). The  trial period is 30 days. Next time you’re faced with an unbootable Windows XP system, give ERD Commander a try.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-6875193118290744203?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/6875193118290744203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=6875193118290744203&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6875193118290744203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6875193118290744203'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/07/data-recoverylive-software-erd.html' title='Data Recovery/Live Software-ERD Commander'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hLPHcFodaYU/SmNklyIHbJI/AAAAAAAAADE/4IlMIOITayw/s72-c/erd.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-7736391654626814079</id><published>2009-05-02T05:03:00.000-07:00</published><updated>2009-05-02T05:12:47.739-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Converting Text to RSS Feeds</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_hLPHcFodaYU/Sfw4roD9vtI/AAAAAAAAACw/HRP-91bH6oI/s1600-h/blogscreens.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 200px;" src="http://2.bp.blogspot.com/_hLPHcFodaYU/Sfw4roD9vtI/AAAAAAAAACw/HRP-91bH6oI/s320/blogscreens.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5331198381039402706" /&gt;&lt;/a&gt;&lt;br /&gt;Today i used created a good method to parse a raw text document to rss feeds using Generic Handlers.Please refer the code below.&lt;br /&gt;&lt;%@ WebHandler Language="C#" Class="Cricket" %&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Net;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Linq;&lt;br /&gt;public class Cricket : IHttpHandler {&lt;br /&gt;&lt;br /&gt;    public void ProcessRequest(HttpContext context)&lt;br /&gt;    {&lt;br /&gt;        StringBuilder sb=new StringBuilder();&lt;br /&gt;        context.Response.ContentType = "text/xml";&lt;br /&gt;        sb.Append(@"&lt;?xml version=""1.0"" encoding=""utf-8""?&gt;               &lt;br /&gt;&lt;rss version=""2.0""&gt;&lt;br /&gt;	&lt;channel&gt;&lt;br /&gt;		&lt;title&gt;Score&lt;/title&gt;&lt;br /&gt;		&lt;link&gt;http://renjucool.co.nr&lt;/link&gt;&lt;br /&gt;		&lt;description&gt;Get latest score&lt;/description&gt;&lt;br /&gt;		&lt;copyright&gt;(c) 2008 renjucool.co.nr&lt;/copyright&gt;&lt;br /&gt;		&lt;br /&gt;		");&lt;br /&gt;        sb.Append("&lt;item&gt;");&lt;br /&gt;        sb.Append("&lt;title&gt;Score of "+DateTime.Now.ToShortDateString()+"&lt;/title&gt;");&lt;br /&gt;        sb.Append("&lt;description&gt;Score of " + GetScore() + "&lt;/description&gt;");&lt;br /&gt;        sb.Append("&lt;link&gt;Score of " + GetScore() + "&lt;/link&gt;");&lt;br /&gt;        sb.Append("&lt;pubdate&gt;Score of " +  DateTime.Now.ToString("ddd, MMM yyyy hh:mm:ss tt")  + "&lt;/pubdate&gt;");&lt;br /&gt;        sb.Append("&lt;/item&gt;");&lt;br /&gt;        sb.Append(@"&lt;br /&gt;	&lt;/channel&gt;&lt;br /&gt;&lt;/rss&gt;&lt;br /&gt;");&lt;br /&gt;        context.Response.Write(sb.ToString());&lt;br /&gt;    }&lt;br /&gt;    public string GetScore()&lt;br /&gt;    {&lt;br /&gt;        string ret = "";&lt;br /&gt;        WebClient myClient = new WebClient();&lt;br /&gt;        String data=Encoding.ASCII.GetString(myClient.DownloadData&lt;br /&gt;                                        ("http://renju.sparkonnet.com/files/raw.tx"));&lt;br /&gt;&lt;br /&gt;        foreach (string s in (from s in data.Split((char)10) select GetValue(s)))&lt;br /&gt;        {&lt;br /&gt;            ret += " "+s;&lt;br /&gt;        }&lt;br /&gt;        return ret;&lt;br /&gt;    }&lt;br /&gt;    public string GetValue(string inp)&lt;br /&gt;    {&lt;br /&gt;        if (inp.IndexOf("=") == -1) return inp;&lt;br /&gt;        return inp.Substring(inp.IndexOf("=") + 1);&lt;br /&gt;    }&lt;br /&gt;     &lt;br /&gt;    public bool IsReusable {&lt;br /&gt;        get {&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;Please refer the screen shot as the code contains html tags&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-7736391654626814079?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/7736391654626814079/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=7736391654626814079&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7736391654626814079'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7736391654626814079'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/05/converting-text-to-rss-feeds.html' title='Converting Text to RSS Feeds'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_hLPHcFodaYU/Sfw4roD9vtI/AAAAAAAAACw/HRP-91bH6oI/s72-c/blogscreens.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-1055380387872701051</id><published>2009-04-23T09:41:00.000-07:00</published><updated>2009-04-23T09:45:37.806-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>v$session for oracle and sql server</title><content type='html'>select * from sys.sysprocesses &lt;br /&gt;&lt;br /&gt;can be used for sql server instead of v$session in oracle&lt;br /&gt;&lt;br /&gt;If you work with SQL Server or Oracle you at some point probably will need to determine your unique connection identifier. For SQL Server, the connection identifier is called a Server Process ID or SPID. It can be obtained from the global @@SPID as: &lt;br /&gt; SELECT @@SPID&lt;br /&gt;Once the SPID is determined, it can be used to query various system tables (e.g., sysprocesses, sysobjects, etc.) to obtain process information. &lt;br /&gt;For Oracle, the connection identifier is called a Session ID or SID. To get the Session ID, the V$SESSION view must be queried as: &lt;br /&gt;&lt;br /&gt; SELECT sid from v$session where audsid = userenv('sessionid'); &lt;br /&gt;When the SID is determined, it can be used to find out session information using other Oracle provided system views such as V$SQL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-1055380387872701051?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/1055380387872701051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=1055380387872701051&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/1055380387872701051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/1055380387872701051'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/04/vsession-for-oracle-and-sql-server.html' title='v$session for oracle and sql server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-600516732274344701</id><published>2009-04-23T04:42:00.000-07:00</published><updated>2009-10-26T12:43:02.840-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Disk I/O:The Performance Bottle neck</title><content type='html'>Many people think of "performance tuning" as optimizing loops, algorithms, and memory use. In truth, however, you don't get the huge performance gains from optimizing CPU and memory use (which is good), but from eliminating I/O calls.&lt;br /&gt;&lt;br /&gt;Disk I/O is responsible for almost all slow websites and desktop applications. It's true. Watch your CPU use next time you open a program, or your server is under load. CPUs aren't the bottleneck anymore - your hard drive is. At the hardware level, the hard drive is the slowest component by an incredibly large factor. Today's memory ranges between 3200 and 10400 MB/s. In contrast, today's desktop hard drive speeds average about 50 MB/s (Seagate 500GB), with high-end drives getting 85MB/s (WD 640, Seagate 1TB). If you're looking at bandwidth, hard drives are 200-300 times slower. Bandwidth, though, isn't the killer - it's the latency. Few modern hard drives have latencies under 13 milliseconds - while memory latency is usually about 5 nanoseconds - 2,000 times faster. &lt;br /&gt;&lt;br /&gt;You're probably looking at these numbers and thinking, "13ms is quite fast enough for me, and my app is only dealing with small files". However, I have a question: what other applications are using that drive? If you're on a shared server, the odds are high that between 25 and 2500 ASP.NET apps are being run on the same drive. &lt;br /&gt;&lt;br /&gt;CPU, bandwidth, and memory throttling is becoming more and more common on shared servers and virtualization systems, but practical disk throttling isn't even on the horizon from what I can tell. Improper I/O usage from any app affects everybody.&lt;br /&gt;&lt;br /&gt;Since hard drives are slow, pending operations go into a queue. So even if your app only needs a single byte of data from the hard drive, it still has to wait its turn. It's quite common for disk operations to take several seconds on a shared server under heavy load. If any application on the server is paging to disk from exessive memory use, it can take several minutes, causing a timeout.&lt;br /&gt;&lt;br /&gt;Realistic I/O performance is really hard to simulate in a development environment. On a dedicated development machine, disk queues are short, and response times are usually near the optimal 13ms, which tends to give software developers gravely incrorrect ideas about the performance characteristics of their application. &lt;br /&gt;&lt;br /&gt;This is one of my favourite article i read,refer &lt;a href="http://nathanaeljones.com/11061_Performance_killer_Disk_I_O"&gt;Click to read more&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-600516732274344701?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/600516732274344701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=600516732274344701&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/600516732274344701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/600516732274344701'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/04/disk-iothe-performance-bottle-neck.html' title='Disk I/O:The Performance Bottle neck'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2089561796224525745</id><published>2009-04-05T11:31:00.000-07:00</published><updated>2009-04-18T23:26:44.676-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>String Searching in a database</title><content type='html'>This is the query which searches for string in the entire DB. &lt;br /&gt;Provide 2 inputs as DB name and Search string.&lt;br /&gt;This query takes more time, but will sure get you the results. &lt;br /&gt;You can customize the search criteria… &lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;!--&lt;br /&gt;google_ad_client = "pub-2999045292721016";&lt;br /&gt;/* 468x15, link ads */&lt;br /&gt;google_ad_slot = "4735904810";&lt;br /&gt;google_ad_width = 468;&lt;br /&gt;google_ad_height = 15;&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&lt;br /&gt;src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;---------------------------------------------------------- &lt;br /&gt;Use [Database_Name] &lt;br /&gt;go &lt;br /&gt;declare @SearchChar varchar(8000) &lt;br /&gt;Set @SearchChar = 'Search_Text' -- Like 'renju%', '11/11/2006' &lt;br /&gt;declare @CMDMain varchar(8000), @CMDMainCount varchar(8000),@CMDJoin varchar(8000) &lt;br /&gt;declare @ColumnName varchar(100),@TableName varchar(100) &lt;br /&gt;declare dbTable cursor for &lt;br /&gt;SELECT &lt;br /&gt;Distinct b.Name as TableName &lt;br /&gt;FROM sysobjects b &lt;br /&gt;WHERE &lt;br /&gt;b.type='u' and b.Name &lt;&gt; 'dtproperties' order by b.name &lt;br /&gt;&lt;br /&gt;open dbTable &lt;br /&gt;fetch next from dbTable into @TableName &lt;br /&gt;WHILE @@FETCH_STATUS = 0 &lt;br /&gt;BEGIN &lt;br /&gt;declare db cursor for &lt;br /&gt;SELECT c.Name as ColumnName &lt;br /&gt;FROM sysobjects b,syscolumns c &lt;br /&gt;WHERE C.id = b.id and &lt;br /&gt;b.type='u' and b.Name = @TableName &lt;br /&gt;order by b.name &lt;br /&gt;&lt;br /&gt;open db &lt;br /&gt;fetch next from db into @ColumnName &lt;br /&gt;set @CMDMain = 'SELECT ' + char(39) + @TableName + char(39) + ' as TableName,'+ &lt;br /&gt;' ['+ @TableName + '].* FROM [' + @TableName + ']'+ &lt;br /&gt;' WHERE ' &lt;br /&gt;set @CMDMainCount = 'SELECT Count(*) FROM [' + @TableName + '] Where ' &lt;br /&gt;Set @CMDJoin = '' &lt;br /&gt;&lt;br /&gt;WHILE @@FETCH_STATUS = 0 &lt;br /&gt;BEGIN &lt;br /&gt;set @CMDJoin = @CMDJoin + 'Convert(varchar(5000),[' +@ColumnName + ']) like ' + char(39) + @SearchChar + char(39) + ' OR ' &lt;br /&gt;fetch next from db into @ColumnName &lt;br /&gt;end &lt;br /&gt;close db &lt;br /&gt;deallocate db &lt;br /&gt;Set @CMDMainCount = 'If ('+ @CMDMainCount + Left(@CMDJoin, len(@CMDJoin) - 3)+ ') &gt; 0 Begin ' &lt;br /&gt;Set @CMDMain = @CMDMainCount + @CMDMain + Left(@CMDJoin, len(@CMDJoin) - 3) &lt;br /&gt;Set @CMDMain = @CMDMain + ' End ' &lt;br /&gt;Print @CMDMain &lt;br /&gt;exec (@CMDMain) &lt;br /&gt;fetch next from dbTable into @TableName &lt;br /&gt;end &lt;br /&gt;close dbTable &lt;br /&gt;deallocate dbTable &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;Renju&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2089561796224525745?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2089561796224525745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2089561796224525745&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2089561796224525745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2089561796224525745'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/04/string-searching-in-database.html' title='String Searching in a database'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4644819675889873218</id><published>2009-03-07T06:35:00.001-08:00</published><updated>2009-03-07T06:41:49.213-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Performance Tunning'/><title type='text'>Top Ten  IIS Performance Optimization</title><content type='html'>1) Enable HTTP Keep-Alive&lt;br /&gt;This setting is enabled by default. Set a side that this could improve client connection experience, this must be enabled in order for integrated authentication or all connection based authentication to work.&lt;br /&gt;&lt;br /&gt;2)  Adjust Connection Timeouts &lt;br /&gt;Right on the spot, as highlighted by the author. You may want to adjust this according to your needs. To me, I felt 120 seconds is way to long for a connection timeout. Typically, I set for 30 to 45 seconds, if "I', the IIS server take longer than that to response to client or waiting for data, I would just drop it. No point holding the resource for more than 30 seconds :)  Obviously, you need to evaluate your environment to derive the correct timeout value.&lt;br /&gt;&lt;br /&gt;3)  Enable HTTP Compression&lt;br /&gt;Yes, some prefer third party tool like httpzip or xcompress. While if you like me. I will stick with the built-in compression feature. Refer this kb to add in more document types for compression:&lt;br /&gt;&lt;a href="http://support.microsoft.com/?id=234497"&gt;Click&lt;/a&gt; How to specify additional document types for HTTP compression&lt;br /&gt;&lt;br /&gt;4)  Grow a Web Garden &lt;br /&gt;This can be tricky, although this will boots up your application response time, do take note that if you are using any session variables make sure you have out-of-process session management in place, otherwise - since all worker processes inside the web garden do not share the memory space, having an in-process session management will cause session detail lost if the request was previously handle by other worker process. The following KB explains about the session management for ASP.NET.&lt;br /&gt;&lt;a href="http://support.microsoft.com/?id=307598 "&gt;Click&lt;/a&gt;&lt;br /&gt;INFO: ASP.NET State Management Overview&lt;br /&gt;&lt;br /&gt;5) Adjust the IIS Object Cache TTL &lt;br /&gt;Great suggestion, the default value is too fast. Typically, I would go for 60 seconds at least. Unless, your site is pure dynamic and content must not be cached. In related to this Object TTL, You would also have the UserToken TTL, by default this is 15mins, which I think suitable for most of the setup. If you have a pretty dynamic user accounts management. E.g. temp account created on the fly and only valid for a short period, you might want to shorter the value. With IIS 6, setting it to '0' will disable the UserToken cache. More info, refer&lt;br /&gt;&lt;a href="http://support.microsoft.com/?id=152526 "&gt;Click&lt;/a&gt;&lt;br /&gt;Changing the Default Interval for User Tokens in IIS&lt;br /&gt;&lt;br /&gt;6) Recycle &lt;br /&gt;Specifically, apply to IIS 6 only. While most users will stick the default, I on the other hand will disable all recycling event coz I think if an application is well-written and tested. It should not behavior weird and causing issue :)  Well, this is just my wish, in real life - especially those IIS that you manage? For sure haunting you from time to time. I remembered in the past where developer always complaint about “something wrong with your IIS configuration’, while you, the system admin on the other hand keep fighting back saying that you are innocent, it is the code that causing this. Until, you find way to prove that it has nothing to do with IIS and the problem is with the application, your boss would typically go with developer :)  Anyway - back to the topic. If you are seeing problem with your application, you should use any of the recycle events to keep up the application availability until you figure out what's wrong. Also, always checked 'shutdown worker process after being idle for' for X minutes. Recycling is good, not only it refreshes your application (sometime I don't agreed with this view), but it also returns the unused resource by to the system pool. Oh ya! What do you do with IIS 5? Well, you can try the IIS5 process recycling tool, refer&lt;br /&gt;&lt;a href="http://support.microsoft.com/?id=322350 "&gt;Click&lt;/a&gt;&lt;br /&gt;How to recycle IIS 5.0 with the IIS 5.0 Process Recycling tool&lt;br /&gt;&lt;br /&gt;7) Limit Queue Length &lt;br /&gt;I'm happy with the default limit, there's typo in the article. Default is 4000 not 1000 :) And of coz at any time - you should not see lot of queue requests, if you do see that, meaning you are either experiencing hardware bottleneck or something really wrong with your application.&lt;br /&gt;&lt;br /&gt;8) Shift Priority to the Working Set&lt;br /&gt;I am lazy :) I never really change this setting unless is for SQL server. When you running on a low power box with less cpu power and memory - you should look into this.&lt;br /&gt;&lt;br /&gt;9) Add Memory &lt;br /&gt;Mm.... to my standard - I have lot of budget - my web server are typically equipped with 2GB memory and this is good enough for most of the web application out there. Of coz, depending on the number of users and application nature - you may need more ram or even setup network load balancing. In the past, I have been seeing to boots up web server you need more CPU processing power, while database server needs tons of memory. That's just what I have experienced, anyway - for you to make the right call - always do a performance monitoring to determine if memory is a bottleneck.&lt;br /&gt;&lt;br /&gt;10)  Use Disk Striping&lt;br /&gt;This is like a bonus. In my opinion, since you have no control for the IIS binaries reside on the system partition, you should have maximum read output for your website pages, and maximum write performance for the log files. Hence, you should have a mirrorset for web pages, and disk striping without parity for the log files. Also, it always the best practice to have the above (IIS binaries, Web pages, IIS log files) in three different partitions/drive and secure it properly with NTFS permissions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4644819675889873218?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4644819675889873218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4644819675889873218&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4644819675889873218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4644819675889873218'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/03/top-ten-iis-performance-optimization.html' title='Top Ten  IIS Performance Optimization'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2810853490348428118</id><published>2009-02-27T23:40:00.000-08:00</published><updated>2009-03-07T06:50:48.910-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Performance Tunning'/><title type='text'>Enabling HTTP Compression in IIS 6.0</title><content type='html'>HTTP Compression is when a Web server receives a request for a file and instead of just serving the file to the client, it checks to see if the client browser (or application) is "Compression Enabled". If so, the Web server does a check on what type of file is being requested (this is determined by the file’s extension). If the file is marked as a static file, such as an HTML file, IIS will check the Compression Cache Temporary Directory.&lt;br /&gt;&lt;br /&gt;Tip: To find the Compression Cache Temporary Directory, open up IIS and right-click on the Web Sites node and go to the Service tab. There is a text box that has a label next to it marked Temporary Directory, although it may not yet be enabled. &lt;br /&gt;&lt;br /&gt;If a compressed version isn’t found, IIS will send an uncompressed version of the file to the client and a compressed version is placed in the temporary directory (IIS will only serve to the client from the temp directory). If the compressed version is found, IIS will send the file directly to the requesting client. If the requested file is a dynamic file, such as an ASP.NET Web form, then the response is dynamically compressed and sent to the requesting client (no temp directory access is ever done).&lt;br /&gt;&lt;br /&gt;Enabling HTTP Compression on your Windows 2003 Server&lt;br /&gt;&lt;br /&gt;There are quite a few steps to enabling HTTP Compression on your server. If you follow the steps in this article, you shouldn’t have any issues.&lt;br /&gt;&lt;br /&gt;First, open up IIS and right-click on the Web Sites node and go to Properties. Click on the Service tab. As shown in FIGURE 1, you’ll see two options: Isolation mode and HTTP compression. If the Run WWW service in IIS 5.0 isolation mode check box is checked, IIS will run almost exactly like IIS 5.0. This means you won’t be able to take advantage of things such as Application Pools, which in my opinion are worth the upgrade to IIS 6.0 by themselves.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hLPHcFodaYU/Sajr8KqOLPI/AAAAAAAAACI/shNAjpu9HzI/s1600-h/1.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 320px;" src="http://1.bp.blogspot.com/_hLPHcFodaYU/Sajr8KqOLPI/AAAAAAAAACI/shNAjpu9HzI/s320/1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5307751579742252274" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;FIGURE 1: The Web Sites Properties dialog box&lt;br /&gt;&lt;br /&gt;We’ll utilize the options within HTTP compression in this article:&lt;br /&gt;&lt;br /&gt;Compress application files. Check this to compress application files. If you do select this, you must also have Compress static files checked, although you won't be warned of this need. &lt;br /&gt;Compress static files. Check this to compress static files. After you do so, the Temporary directory text box is active. &lt;br /&gt;Temporary directory. You can leave this at the default, which is %windir%\IIS Temporary Compressed Files, or set it to a custom folder. This is where temporary compressed static files will be stored. &lt;br /&gt;Maximum temporary directory size. This option enables you to set the maximum size of the temporary directory. After the size is met, items are removed based on duration; the older files are removed and the new files are put in. &lt;br /&gt;Next, go to the Web Service Extensions node. Right-click in the right pane, and click Add a new Web service extension. The New Web Service Extension dialog box appears, as shown in FIGURE 2. You can enter any name for the extension, but what others, including myself, recommend is HTTP Compression.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_hLPHcFodaYU/SajsbzhKSDI/AAAAAAAAACQ/DIU3LCFHzZ0/s1600-h/2.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 275px;" src="http://4.bp.blogspot.com/_hLPHcFodaYU/SajsbzhKSDI/AAAAAAAAACQ/DIU3LCFHzZ0/s320/2.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5307752123286046770" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;FIGURE 2: The Web Service Extension dialog box&lt;br /&gt;&lt;br /&gt;Click on Add. Choose C:\WINDOWS\system32\inetsrv\gzip.dll (your path may be different, but that is doubtful), and click OK. Check the Set extension status to Allowed check box, and click OK.&lt;br /&gt;&lt;br /&gt;IIS 6.0 Metabase Configuration - MetaBase.xml&lt;br /&gt;Open up Windows Explorer and go to C:\Windows\System32\inetsrv. Find MetaBase.xml and make a copy (you can just highlight it and do a Ctrl-C, then a Ctrl-P to make a copy of MetaBase.xml). Now open up MetaBase.xml in a text editor. Find the &lt;IIsCompressionScheme/&gt; section. Be careful, there are two sections here: one for deflate and one for gzip. We want gzip so the Location attribute of the element will have the following value:&lt;br /&gt;&lt;br /&gt;Location ="/LM/W3SVC/Filters/Compression/gzip" &lt;br /&gt;&lt;br /&gt;Look for the HcScriptFileExtensions section. Your default should have: asp, dll, and exe. This is where you add any extensions you want to compress for dynamic files. In my case, I added aspx. &lt;br /&gt;&lt;br /&gt;You’ll notice many other attributes in FIGURE 3. These are the ones I find most important:&lt;br /&gt;&lt;br /&gt;HcDoDynamicCompression. Specifies whether dynamic content should be compressed. This is important because dynamic content is by definition always changing, and IIS does not cache compressed versions of dynamic output. Thus, if dynamic compression is enabled, each request for dynamic content causes the content to be compressed. Dynamic compression consumes considerable CPU time and memory resources, and should only be used on servers that have slow network connections, but CPU time to spare. &lt;br /&gt;HcDoStaticCompression. Specifies whether static content should be compressed. &lt;br /&gt;HcDoOnDemandCompression: Specifies whether static files, such as .htm and .txt files, are compressed if a compressed version of the file does not exist. If set to True and a file doesn't exist, the user will be sent an uncompressed file while a background thread creates a compressed version for the next request. &lt;br /&gt;HcDynamicCompressionLevel. VAL(1-10) specifies the compression level for the compression scheme, when the scheme is compressing dynamic content. Low compression levels produce slightly larger compressed files, but with lower overall impact on CPU and memory resources. Higher compression levels generally result in smaller compressed files, but with higher CPU and memory usage. &lt;br /&gt;HcFileExtensions. Indicates which file name extensions are supported by the compression scheme. Only static files with the specified file extensions are compressed by IIS. If this setting is empty, no static files are compressed. &lt;br /&gt;HcScriptFileExtensions. Indicates which file name extensions are supported by the compression scheme. The output from dynamic files with the file extensions specified in this property are compressed by IIS. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hLPHcFodaYU/SajsvT5NEII/AAAAAAAAACY/j2QUkRojqEw/s1600-h/3.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 246px;" src="http://1.bp.blogspot.com/_hLPHcFodaYU/SajsvT5NEII/AAAAAAAAACY/j2QUkRojqEw/s320/3.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5307752458394341506" /&gt;&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;FIGURE 3: Essential attributes&lt;br /&gt;&lt;br /&gt;For this example, just add aspx to the HcScriptFileExtensions section as I did, but don’t try to save. It won’t work because the file is locked by default if IIS is running.&lt;br /&gt;&lt;br /&gt;Tip: To change this default behavior, open IIS and right-click on the top node, Internet Information Services, and check Enable Direct Metabase Edit.&lt;br /&gt;&lt;br /&gt;Warning: The help documents state that you should use a space delimited list for the file extensions, and I have found this to be incorrect. Instead, use new lines and tabs like the following: &lt;br /&gt;&lt;br /&gt;&lt;IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/gzip"&lt;br /&gt;HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"&lt;br /&gt;HcCreateFlags="1"&lt;br /&gt;HcDoDynamicCompression="TRUE"&lt;br /&gt;HcDoOnDemandCompression="TRUE"&lt;br /&gt;HcDoStaticCompression="TRUE"&lt;br /&gt;HcDynamicCompressionLevel="10"&lt;br /&gt;HcFileExtensions="htm&lt;br /&gt;html&lt;br /&gt;txt"&lt;br /&gt;HcOnDemandCompLevel="10"&lt;br /&gt;HcPriority="1"&lt;br /&gt;HcScriptFileExtensions="asp&lt;br /&gt;dll&lt;br /&gt;exe&lt;br /&gt;aspx"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The final step is to do an IIS shutdown and restart by right-clicking in Internet Information Services node and then click All Tasks, Restart IIS.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2810853490348428118?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2810853490348428118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2810853490348428118&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2810853490348428118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2810853490348428118'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/02/enabling-http-compression-in-iis-60.html' title='Enabling HTTP Compression in IIS 6.0'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hLPHcFodaYU/Sajr8KqOLPI/AAAAAAAAACI/shNAjpu9HzI/s72-c/1.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-3116187070449621230</id><published>2009-01-25T09:16:00.000-08:00</published><updated>2009-11-18T11:17:41.734-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Upload T-SQL and execute at your hosting provider using an ASP.NET page</title><content type='html'>With this approach, you can use the Database Publishing Wizard to generate a T-SQL file from your local database. Then, you can upload the script to your hosting provider, and use the sample ASP.NET page provided to execute the code below.&lt;br /&gt;&lt;br /&gt;This approach is useful in the following circumstances:&lt;br /&gt;&lt;br /&gt;    * Your hosting provider has not deployed the Database Publishing Services, enabling simple publishing of your SQL Server database&lt;br /&gt;    * Your hosting provider does not have a T-SQL script execution window or the T-SQL script generated by the Database Publishing Wizard is too large to paste into the T-SQL script execution window&lt;br /&gt;&lt;br /&gt;Here is the code, just copy it then paste to your RunSQL.aspx&lt;br /&gt;&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;&lt;%@ Page Language="C#" AutoEventWireup="true"  %&gt;&lt;br /&gt;&lt;%@ Import Namespace="System.Data" %&gt;&lt;br /&gt;&lt;%@ Import Namespace="System.Data.SqlClient" %&gt;&lt;br /&gt;&lt;%@ Import Namespace="System.IO" %&gt;&lt;br /&gt;&lt;%@ Import Namespace="System.Net" %&gt;&lt;br /&gt;&lt;%&lt;br /&gt;    // **************************************************************************&lt;br /&gt;    // Update these variables here&lt;br /&gt;    // ************************************************************************** &lt;br /&gt;    // Url of the T-SQL file you want to run&lt;br /&gt;&lt;br /&gt;    string fileUrl = @"http://&lt;&lt;YourDomainName&gt;&gt;/&lt;&lt;YourFileName&gt;&gt;.sql";    &lt;br /&gt;    &lt;br /&gt;    // Connection string to the server you want to execute against&lt;br /&gt;    string connectionString = @"&lt;&lt;Your Connection String&gt;&gt;";&lt;br /&gt;    &lt;br /&gt;    // Timeout of batches (in seconds)&lt;br /&gt;    int timeout = 600;&lt;br /&gt; %&gt;&lt;br /&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;&lt;br /&gt;&lt;head runat="server"&gt;&lt;br /&gt;    &lt;title&gt;Executing T-SQL&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;    &lt;form id="form1" runat="server"&gt;&lt;br /&gt;    &lt;div&gt;    &lt;br /&gt;    &lt;/div&gt;&lt;br /&gt;    &lt;/form&gt;&lt;br /&gt;    &lt;%&lt;br /&gt;        SqlConnection conn = null;                   &lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            this.Response.Write(String.Format("Opening url {0}&lt;BR&gt;", fileUrl));&lt;br /&gt;            &lt;br /&gt;            // read file&lt;br /&gt;            WebRequest request = WebRequest.Create(fileUrl);&lt;br /&gt;            using (StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream()))&lt;br /&gt;            {&lt;br /&gt;                this.Response.Write("Connecting to SQL Server database...&lt;BR&gt;");&lt;br /&gt;                &lt;br /&gt;                // Create new connection to database&lt;br /&gt;                conn = new SqlConnection(connectionString);               &lt;br /&gt;                &lt;br /&gt;                conn.Open();&lt;br /&gt;&lt;br /&gt;                while (!sr.EndOfStream)&lt;br /&gt;                {&lt;br /&gt;                    StringBuilder sb = new StringBuilder();&lt;br /&gt;                    SqlCommand cmd = conn.CreateCommand();&lt;br /&gt;                    &lt;br /&gt;                    while (!sr.EndOfStream)&lt;br /&gt;                    {&lt;br /&gt;                        string s = sr.ReadLine();&lt;br /&gt;                        if (s != null &amp;&amp; s.ToUpper().Trim().Equals("GO"))&lt;br /&gt;                        {&lt;br /&gt;                            break;&lt;br /&gt;                        }&lt;br /&gt;                        &lt;br /&gt;                        sb.AppendLine(s);&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    // Execute T-SQL against the target database&lt;br /&gt;                    cmd.CommandText = sb.ToString();&lt;br /&gt;                    cmd.CommandTimeout = timeout;&lt;br /&gt;&lt;br /&gt;                    cmd.ExecuteNonQuery();&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;            this.Response.Write("T-SQL file executed successfully");&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            this.Response.Write(String.Format("An error occured: {0}", ex.ToString()));&lt;br /&gt;        }&lt;br /&gt;        finally&lt;br /&gt;        {&lt;br /&gt;            // Close out the connection&lt;br /&gt;            //&lt;br /&gt;            if (conn != null)&lt;br /&gt;            {&lt;br /&gt;                try&lt;br /&gt;                {&lt;br /&gt;                    conn.Close();&lt;br /&gt;                    conn.Dispose();&lt;br /&gt;                }&lt;br /&gt;                catch (Exception e)&lt;br /&gt;                {&lt;br /&gt;                    this.Response.Write(String.Format(@"Could not close the connection.  Error was {0}", e.ToString()));&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }                                 &lt;br /&gt;        %&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Below are the instructions to use this approach:&lt;br /&gt;&lt;br /&gt;   1. Run the Database Publishing Wizard to generate a T-SQL script file for your local database&lt;br /&gt;   2. Using FTP (or another approach if applicable), upload this T-SQL file to your hosting account&lt;br /&gt;   3. Download the sample ASP.NET page by clicking on this link: RunSQL.aspx&lt;br /&gt;   4. Edit the ASPX page and change the values of the variables fileUrl and connectionString as follows:&lt;br /&gt;         1. fileUrl should be the url of the T-SQL file you uploaded. For example if your domain name is www.mydomain.Com, then the url would be http://www.mydomain.com/File.Sql&lt;br /&gt;         2. connectionString should be the connection string of your hosted SQL Server database&lt;br /&gt;   5. Upload the ASPX page to your hosting account&lt;br /&gt;   6. Point your web browser to the ASPX page you uploaded. When this page has completed loading, your database should now be populated in the remote SQL Server database&lt;br /&gt;   7. Important: Delete the T-SQL file and ASPX page in your hosting account. This will prevent others from reading your data or tampering with your database.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-3116187070449621230?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/3116187070449621230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=3116187070449621230&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3116187070449621230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3116187070449621230'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2009/01/upload-t-sql-and-execute-at-your.html' title='Upload T-SQL and execute at your hosting provider using an ASP.NET page'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5021355308844932110</id><published>2008-12-28T00:40:00.000-08:00</published><updated>2009-01-25T09:15:55.635-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Stored Procedure using the most CPU</title><content type='html'>The following query gives you a high-level view of which currently cached batches or procedures are using the most CPU. The query aggregates the CPU consumed by all statements with the same plan__handle (meaning that they are part of the same batch or procedure). If a given plan_handle has more than one statement, you may have to drill in further to find the specific query that is the largest contributor to the overall CPU usage. &lt;br /&gt;select top 50 &lt;br /&gt;    sum(qs.total_worker_time) as total_cpu_time, &lt;br /&gt;    sum(qs.execution_count) as total_execution_count,&lt;br /&gt;    count(*) as  number_of_statements, &lt;br /&gt;    qs.plan_handle &lt;br /&gt;from &lt;br /&gt;    sys.dm_exec_query_stats qs&lt;br /&gt;group by qs.plan_handle&lt;br /&gt;order by sum(qs.total_worker_time) desc&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5021355308844932110?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5021355308844932110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5021355308844932110&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5021355308844932110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5021355308844932110'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/12/using-most-cpu.html' title='Stored Procedure using the most CPU'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4137201236278316952</id><published>2008-12-13T06:56:00.000-08:00</published><updated>2008-12-13T07:15:34.995-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Creating Antibot Image With c#</title><content type='html'>Antibots images are needed for avoiding Trojans to make fake registration with out human interaction.In the method given below generate random strings and generate the bitmap of that.This method Should be added as web handler(ashx) in the asp.net project.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  public void ProcessRequest(HttpContext context)&lt;br /&gt;    {&lt;br /&gt;        if(context.Session["antibotimage"] == null)&lt;br /&gt;        {&lt;br /&gt;            context.Session["antibotimage"] = generateRandomString(4).ToUpper();&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        GenerateImage(context.Session["antibotimage"].ToString(), 100, 20, "Arial").Save(context.Response.OutputStream, ImageFormat.Jpeg);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; private Bitmap GenerateImage(string text, int width, int height, string fontFamily)&lt;br /&gt;    {&lt;br /&gt;        Random random = new Random();&lt;br /&gt;&lt;br /&gt;        // Create a new 32-bit bitmap image.&lt;br /&gt;        Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);&lt;br /&gt;&lt;br /&gt;        // Create a graphics object for drawing.&lt;br /&gt;        Graphics g = Graphics.FromImage(bitmap);&lt;br /&gt;        g.SmoothingMode = SmoothingMode.AntiAlias;&lt;br /&gt;        Rectangle rect = new Rectangle(0, 0, width, height);&lt;br /&gt;&lt;br /&gt;        // Fill in the background.&lt;br /&gt;        HatchBrush hatchBrush = new HatchBrush(HatchStyle.Wave, Color.LightGray, Color.White);&lt;br /&gt;        g.FillRectangle(hatchBrush, rect);&lt;br /&gt;&lt;br /&gt;        // Set up the text font.&lt;br /&gt;        SizeF size;&lt;br /&gt;        float fontSize = rect.Height + 1;&lt;br /&gt;        Font font;&lt;br /&gt;        StringFormat format = new StringFormat();&lt;br /&gt;        format.Alignment = StringAlignment.Center;&lt;br /&gt;        format.LineAlignment = StringAlignment.Center;&lt;br /&gt;&lt;br /&gt;        // Adjust the font size until the text fits within the image.&lt;br /&gt;        do&lt;br /&gt;        {&lt;br /&gt;            fontSize--;&lt;br /&gt;            font = new Font(fontFamily, fontSize, FontStyle.Bold);&lt;br /&gt;            size = g.MeasureString(text, font, new SizeF(width, height), format);&lt;br /&gt;        } while (size.Width &gt; rect.Width);&lt;br /&gt;&lt;br /&gt;        // Create a path using the text and warp it randomly.&lt;br /&gt;        GraphicsPath path = new GraphicsPath();&lt;br /&gt;        path.AddString(text, font.FontFamily, (int)font.Style, font.Size, rect, format);&lt;br /&gt;        float v = 4F;&lt;br /&gt;        PointF[] points =&lt;br /&gt;   {&lt;br /&gt;    new PointF(random.Next(rect.Width) / v, random.Next(rect.Height) / v),&lt;br /&gt;    new PointF(rect.Width - random.Next(rect.Width) / v, random.Next(rect.Height) / v),&lt;br /&gt;    new PointF(random.Next(rect.Width) / v, rect.Height - random.Next(rect.Height) / v),&lt;br /&gt;    new PointF(rect.Width - random.Next(rect.Width) / v, rect.Height - random.Next(rect.Height) / v)&lt;br /&gt;   };&lt;br /&gt;        Matrix matrix = new Matrix();&lt;br /&gt;        matrix.Translate(0F, 0F);&lt;br /&gt;        path.Warp(points, rect, matrix, WarpMode.Perspective, 0F);&lt;br /&gt;&lt;br /&gt;        // Draw the text.&lt;br /&gt;        hatchBrush = new HatchBrush(HatchStyle.DashedUpwardDiagonal, Color.DarkGray, Color.Black);&lt;br /&gt;        g.FillPath(hatchBrush, path);&lt;br /&gt;&lt;br /&gt;        // Add some random noise.&lt;br /&gt;        int m = Math.Max(rect.Width, rect.Height);&lt;br /&gt;        for (int i = 0; i &lt; (int)(rect.Width * rect.Height / 30F); i++)&lt;br /&gt;        {&lt;br /&gt;            int x = random.Next(rect.Width);&lt;br /&gt;            int y = random.Next(rect.Height);&lt;br /&gt;            int w = random.Next(m / 50);&lt;br /&gt;            int h = random.Next(m / 50);&lt;br /&gt;            g.FillEllipse(hatchBrush, x, y, w, h);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        // Clean up.&lt;br /&gt;        font.Dispose();&lt;br /&gt;        hatchBrush.Dispose();&lt;br /&gt;        g.Dispose();&lt;br /&gt;&lt;br /&gt;        return bitmap;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;private string generateRandomString(int size)&lt;br /&gt;    {&lt;br /&gt;        StringBuilder builder = new StringBuilder();&lt;br /&gt;        Random random = new Random();&lt;br /&gt;        char ch;&lt;br /&gt;        for (int i = 0; i &lt; size; i++)&lt;br /&gt;        {&lt;br /&gt;            ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));&lt;br /&gt;            builder.Append(ch);&lt;br /&gt;        }&lt;br /&gt;        return builder.ToString();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Programmed by&lt;br /&gt; Renju.R,&lt;br /&gt; Software Engineer,&lt;br /&gt; ISOFT, Chennai,India&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4137201236278316952?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4137201236278316952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4137201236278316952&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4137201236278316952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4137201236278316952'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/12/creating-antibot-image-with-c.html' title='Creating Antibot Image With c#'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2884633343866301174</id><published>2008-10-11T00:02:00.000-07:00</published><updated>2008-10-11T00:05:10.597-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Parsing/Looping through Treeview using Interface</title><content type='html'>private static void parseNode(TreeNode tn) &lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            IEnumerator ie = tn.ChildNodes.GetEnumerator();&lt;br /&gt;&lt;br /&gt;            string parentnode = "";&lt;br /&gt;&lt;br /&gt;            parentnode = tn.Text;&lt;br /&gt;&lt;br /&gt;            while (ie.MoveNext()) &lt;br /&gt;            {&lt;br /&gt;                TreeNode ctn = (TreeNode) ie.Current;&lt;br /&gt;&lt;br /&gt;                if (ctn.ChildNodes.Count  == 0) &lt;br /&gt;                {&lt;br /&gt;                    sr.Write(ctn.Text);&lt;br /&gt;                } &lt;br /&gt;                else &lt;br /&gt;                {&lt;br /&gt;                    sr.Write("&lt;" + ctn.Text + "&gt;");&lt;br /&gt;                }&lt;br /&gt;                if (ctn.ChildNodes.Count &gt; 0) &lt;br /&gt;                {&lt;br /&gt;                    parseNode(ctn);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            sr.Write("&lt;/" + parentnode + "&gt;");&lt;br /&gt;            sr.WriteLine("");&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Saving the treeview to XML&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;    public static void exportToXml(TreeView tv, string filename) &lt;br /&gt;        {&lt;br /&gt;            sr = new StreamWriter(filename, false, System.Text.Encoding.UTF8);&lt;br /&gt;            sr.WriteLine("&lt;?xml version=\"1.0\" encoding=\"utf-8\" ?&gt;");&lt;br /&gt;            if (tv.Nodes.Count &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                IEnumerator ie = tv.Nodes.GetEnumerator();&lt;br /&gt;                ie.Reset();&lt;br /&gt;                if (ie.MoveNext())&lt;br /&gt;                {&lt;br /&gt;                    TreeNode tn = (TreeNode)ie.Current;&lt;br /&gt;                    sr.WriteLine("&lt;" + tn.Text + "&gt;");&lt;br /&gt;                    parseNode(tn);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            sr.Close();&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2884633343866301174?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2884633343866301174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2884633343866301174&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2884633343866301174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2884633343866301174'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/10/parsinglooping-through-treeview-using.html' title='Parsing/Looping through Treeview using Interface'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4489958666558015392</id><published>2008-09-14T22:43:00.000-07:00</published><updated>2008-09-14T22:46:04.123-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>SCOPE_IDENTITY</title><content type='html'>Returns the last identity value inserted into an identity column in the same scope. A scope is a module: a stored procedure, trigger, function, or batch. Therefore, two statements are in the same scope if they are in the same stored procedure, function, or batch.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;SCOPE_IDENTITY()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Returns numeric value.eg:- RETURN SCOPE_IDENTITY()&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4489958666558015392?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4489958666558015392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4489958666558015392&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4489958666558015392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4489958666558015392'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/scopeidentity.html' title='SCOPE_IDENTITY'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-3251563223601534873</id><published>2008-09-10T03:56:00.000-07:00</published><updated>2008-09-10T04:33:26.571-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Parsing Emails using Regular Expressions</title><content type='html'>&lt;strong&gt;Using Regular Expressions  &lt;/strong&gt;      &lt;br /&gt;&lt;br /&gt;        Using regular expression we can simply parse valid emails from the given contents.this is mainly used to extract actual email addressess from the to,from,cc and bcc fields.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Implementation(c#)&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;First import using System.Text.RegularExpressions;&lt;br /&gt;&lt;br /&gt;the code is as below  &lt;br /&gt;&lt;br /&gt;   private string ParseEmails(string text)&lt;br /&gt;        {&lt;br /&gt;            const string emailPattern = @"\w+@\w+\.\w+((\.\w+)*)?";&lt;br /&gt;&lt;br /&gt;            MatchCollection emails = Regex.Matches(text, emailPattern, RegexOptions.IgnoreCase);&lt;br /&gt;            StringBuilder emailString = new StringBuilder();&lt;br /&gt;            foreach (Match email in emails)&lt;br /&gt;            {&lt;br /&gt;                if (emailString.Length ==0)&lt;br /&gt;                {&lt;br /&gt;                    emailString.Append(email.Value);&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    emailString.Append("," + email.Value);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            return emailString.ToString();&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-3251563223601534873?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/3251563223601534873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=3251563223601534873&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3251563223601534873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/3251563223601534873'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/parsing-emails-using-regular.html' title='Parsing Emails using Regular Expressions'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-1873154100494886746</id><published>2008-09-07T22:06:00.000-07:00</published><updated>2009-12-19T23:08:41.945-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Word Break for Gridview/DataGrid</title><content type='html'>Sometime we are facing problems with gridview in inserting word breaks to format the grid.ie if we are inserting a coloumn that is having more length so the grid layout is changed.&lt;br /&gt;&lt;br /&gt;"wbr" Tag is used for that.That should be placed in angle bracket("&lt;&gt;").I'm representing it as wbr in the code given below as it is an html tag.&lt;br /&gt;&lt;pre class="c#" name="code"&gt;&lt;br /&gt;public static string WordBreak(String inString, int length)&lt;br /&gt;    {&lt;br /&gt;        StringBuilder stb = new StringBuilder();&lt;br /&gt;        String ret = "";&lt;br /&gt;        int pos;&lt;br /&gt;        if (length == 0)&lt;br /&gt;            length = 10;&lt;br /&gt;        while ((true))&lt;br /&gt;        {&lt;br /&gt;            if (inString.Length &lt;= length)&lt;br /&gt;            {&lt;br /&gt;                ret += inString;&lt;br /&gt;                break;&lt;br /&gt;            }&lt;br /&gt;            pos = inString.IndexOf(" ");&lt;br /&gt;            if (pos != -1)&lt;br /&gt;            {&lt;br /&gt;                if (pos &gt; length - 1)&lt;br /&gt;                {&lt;br /&gt;                    pos = length;&lt;br /&gt;                    ret += inString.Substring(0, pos + 1) + "wbr";&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    ret += inString.Substring(0, pos + 1);&lt;br /&gt;                }&lt;br /&gt;                inString = inString.Substring(pos + 1);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                ret += inString.Substring(0, length) + "wbr";&lt;br /&gt;                inString = inString.Substring(length);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        if (ret.Length &gt; 50)&lt;br /&gt;        {&lt;br /&gt;            string temp = ret.Substring(0, 50);&lt;br /&gt;            stb.Append(temp);&lt;br /&gt;            stb.Append("....");&lt;br /&gt;            ret = stb.ToString();&lt;br /&gt;        }&lt;br /&gt;        return ret;&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;www.renjucool.com&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-1873154100494886746?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/1873154100494886746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=1873154100494886746&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/1873154100494886746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/1873154100494886746'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/word-break-for-gridviewdatagrid.html' title='Word Break for Gridview/DataGrid'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4103198291622478821</id><published>2008-09-06T00:17:00.001-07:00</published><updated>2008-09-06T02:05:56.405-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Don’t run production ASP.NET Applications with debug=”true” enabled</title><content type='html'>One of the things you want to avoid when deploying an ASP.NET application into production is to accidentally (or deliberately) leave the &lt;compilation debug=”true”/&gt; switch on within the application’s web.config file.&lt;br /&gt;Doing so causes a number of non-optimal things to happen including:&lt;br /&gt;&lt;br /&gt;1) The compilation of ASP.NET pages takes longer (since some batch optimizations are disabled)&lt;br /&gt;&lt;br /&gt;2) Code can execute slower (since some additional debug paths are enabled)&lt;br /&gt;&lt;br /&gt;3) Much more memory is used within the application at runtime&lt;br /&gt;&lt;br /&gt;4) Scripts and images downloaded from the WebResources.axd handler are not cached&lt;br /&gt; &lt;br /&gt;This last point is particularly important, since it means that all client-javascript libraries and static images that are deployed via WebResources.axd will be continually downloaded by clients on each page view request and not cached locally within the browser.  This can slow down the user experience quite a bit for things like Atlas, controls like TreeView/Menu/Validators, and any other third-party control or custom code that deploys client resources.  Note that the reason why these resources are not cached when debug is set to true is so that developers don’t have to continually flush their browser cache and restart it every-time they make a change to a resource handler (our assumption is that when you have debug=true set you are in active development on your site).&lt;br /&gt;&lt;br /&gt;When &lt;compilation debug=”false”/&gt; is set, the WebResource.axd handler will automatically set a long cache policy on resources retrieved via it – so that the resource is only downloaded once to the client and cached there forever (it will also be cached on any intermediate proxy servers).  If you have Atlas installed for your application, it will also automatically compress the content from the WebResources.axd handler for you when &lt;compilation debug=”false”/&gt; is set – reducing the size of any client-script javascript library or static resource for you (and not requiring you to write any custom code or configure anything within IIS to get it).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4103198291622478821?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4103198291622478821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4103198291622478821&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4103198291622478821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4103198291622478821'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/dont-run-production-aspnet-applications_06.html' title='Don’t run production ASP.NET Applications with debug=”true” enabled'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-7264031424008065840</id><published>2008-09-05T23:51:00.000-07:00</published><updated>2010-01-12T10:50:36.185-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Model View Controller Pattern</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_hLPHcFodaYU/SMIpEIN-nCI/AAAAAAAAABY/cQh4E71u7o8/s1600-h/cc337884.fig01.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_hLPHcFodaYU/SMIpEIN-nCI/AAAAAAAAABY/cQh4E71u7o8/s320/cc337884.fig01.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5242798067115007010" /&gt;&lt;/a&gt;&lt;br /&gt;Luckily, the ASP.NET team has been listening to developers like me and has started development of a new Web application framework that sits side-by-side with the Web Forms you know and love but has a distinctly different set of design goals:&lt;br /&gt;&lt;br /&gt;    * Embrace HTTP and HTML—don't hide it.&lt;br /&gt;    * Testability is built-in from the ground up.&lt;br /&gt;    * Extensible at almost every point.&lt;br /&gt;    * Total control over your output.&lt;br /&gt;&lt;br /&gt;This new framework is based around the Model View Controller (MVC) pattern, thus the name, ASP.NET MVC. The MVC pattern was originally invented back in the '70s as part of Smalltalk. As I'll show in this article, it actually fits into the nature of the Web quite well. MVC divides your UI into three distinct objects: the controller, which receives and handles input; the model, which contains your domain logic; and the view, which generates your output. In the context of the Web, the input is an HTTP request, and the request flow looks like Figure &lt;br /&gt;above&lt;br /&gt;&lt;br /&gt;This is actually quite different from the process in Web Forms. In the Web Forms model, the input goes into the page (the View), and the view is responsible for both handling the input and generating the output. When it comes to MVC, on the other hand, the responsibilities are separated.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Building Web Apps without Web Forms&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/hi-in/magazine/cc337884(en-us).aspx"&gt;Click Here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-7264031424008065840?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/7264031424008065840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=7264031424008065840&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7264031424008065840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7264031424008065840'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/model-view-controller-pattern.html' title='Model View Controller Pattern'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_hLPHcFodaYU/SMIpEIN-nCI/AAAAAAAAABY/cQh4E71u7o8/s72-c/cc337884.fig01.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-1582609927050431427</id><published>2008-09-05T04:44:00.000-07:00</published><updated>2008-09-05T22:28:52.425-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Insert Values into an Identity Column</title><content type='html'>Identity columns are commonly used as primary keys in database tables.  These columns automatically assign a value for each new row inserted.&lt;br /&gt;&lt;br /&gt;use tempdb&lt;br /&gt;GO&lt;br /&gt;IF OBJECT_ID('IdentityTable') IS NOT NULL&lt;br /&gt; DROP TABLE IdentityTable&lt;br /&gt;GO&lt;br /&gt;CREATE TABLE IdentityTable (&lt;br /&gt; TheIdentity INT NOT NULL IDENTITY(1,1) PRIMARY KEY,&lt;br /&gt; TheValue NVARCHAR(20) NOT NULL )&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;Simply trying to INSERT a value into the identity column generates an error:&lt;br /&gt;&lt;br /&gt;INSERT IdentityTable(TheIdentity, TheValue)&lt;br /&gt;VALUES (1, 'First Row')&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;Msg 544, Level 16, State 1, Line 3&lt;br /&gt;Cannot insert explicit value for identity column in table 'IdentityTable' when IDENTITY_INSERT is set to OFF.&lt;br /&gt;&lt;br /&gt;The trick is to enable IDENTITY_INSERT for the table.  That looks like this:&lt;br /&gt;&lt;br /&gt;SET IDENTITY_INSERT IdentityTable ON&lt;br /&gt;&lt;br /&gt;INSERT IdentityTable(TheIdentity, TheValue)&lt;br /&gt;VALUES (3, 'First Row')&lt;br /&gt;&lt;br /&gt;SET IDENTITY_INSERT IdentityTable OFF&lt;br /&gt;&lt;br /&gt;Here are some key points about IDENTITY_INSERT&lt;br /&gt;&lt;br /&gt;    * It can only be enabled on one table at a time.  If you try to enable it on a second table while it is still enabled on a first table SQL Server will generate an error.&lt;br /&gt;    * When it is enabled on a table you must specify a value for the identity column.&lt;br /&gt;    * The user issuing the statement must own the object, be a system administrator (sysadmin role), be the database owner (dbo) or be a member of the db_ddladmin role in order to run the command.&lt;br /&gt;&lt;br /&gt;If you insert a value greater than the current identity seed SQL Server uses the value to reset the identity seed.  For example:&lt;br /&gt;&lt;br /&gt;SET IDENTITY_INSERT IdentityTable ON&lt;br /&gt;&lt;br /&gt;INSERT IdentityTable(TheIdentity, TheValue)&lt;br /&gt;VALUES (10, 'Row Ten')&lt;br /&gt;&lt;br /&gt;SET IDENTITY_INSERT IdentityTable OFF&lt;br /&gt;&lt;br /&gt;INSERT IdentityTable(TheValue)&lt;br /&gt;VALUES ('Should be 11')&lt;br /&gt;&lt;br /&gt;SELECT * FROM IdentityTable&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;(1 row(s) affected)&lt;br /&gt;&lt;br /&gt;(1 row(s) affected)&lt;br /&gt;TheIdentity TheValue&lt;br /&gt;----------- --------------------&lt;br /&gt;         10 Row Ten&lt;br /&gt;         11 Should be 11&lt;br /&gt;&lt;br /&gt;(2 row(s) affected)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-1582609927050431427?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/1582609927050431427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=1582609927050431427&amp;isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/1582609927050431427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/1582609927050431427'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/insert-values-into-identity-column.html' title='Insert Values into an Identity Column'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2099987627186118267</id><published>2008-09-05T04:11:00.000-07:00</published><updated>2008-09-05T22:28:52.426-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Row Locking</title><content type='html'>BEGIN TRAN&lt;br /&gt;&lt;br /&gt;SELECT *&lt;br /&gt;FROM authors&lt;br /&gt;WITH (HOLDLOCK, ROWLOCK)&lt;br /&gt;WHERE au_id = '274-80-9391'&lt;br /&gt;&lt;br /&gt;/* Do all your stuff here while the record is locked */&lt;br /&gt;&lt;br /&gt;COMMIT TRAN&lt;br /&gt;&lt;br /&gt;The HOLDLOCK hint will instruct SQL Server to hold the lock until you commit the transaction. The ROWLOCK hint will lock only this record and not issue a page or table lock.&lt;br /&gt;&lt;br /&gt;The lock will also be released if you close your connection or it times out. I'd be VERY careful doing this since it will stop any SELECT statements that hit this row dead in their tracks. SQL Server has numerous locking hints that you can use. You can see them in Books Online when you search on either HOLDLOCK or ROWLOCK.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2099987627186118267?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2099987627186118267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2099987627186118267&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2099987627186118267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2099987627186118267'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/row-locking.html' title='Row Locking'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-508897612535200930</id><published>2008-09-05T03:37:00.000-07:00</published><updated>2008-09-05T22:28:52.426-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Converting Time Units With Math</title><content type='html'>*  To convert seconds to hours, simply divide by 3600 (since each hour has 60 seconds * 60 minutes). The remainder is the remaining seconds.&lt;br /&gt;    * To convert seconds to minutes, simply divide by 60. The remainder is the remaining seconds.&lt;br /&gt;&lt;br /&gt;Nothing too shocking there, right? So, let's do some math. If we have a TotalSeconds, we can get:&lt;br /&gt;&lt;br /&gt;    * Hours = (TotalSeconds / 3600)&lt;br /&gt;    * Remaining Minutes = (TotalSeconds % 3600) / 60&lt;br /&gt;    * Remaining Seconds = (TotalSeconds % 60)&lt;br /&gt;&lt;br /&gt;(The % is the modulo operator in T-SQL, which returns the remainder when dividing two integers.)&lt;br /&gt;&lt;br /&gt;Thus, we can write our SQL like this to return 3 integer columns (Hours, Minutes, Seconds) for each event: &lt;br /&gt;&lt;br /&gt;select &lt;br /&gt;  EventID, &lt;br /&gt;  TotalSeconds / 3600 as Hours, &lt;br /&gt;  (TotalSeconds % 3600) / 60 as Minutes, &lt;br /&gt;  TotalSeconds % 60 as Seconds&lt;br /&gt;from&lt;br /&gt;(&lt;br /&gt; select EventID, DateDiff(second, StartDate, EndDate) as TotalSeconds &lt;br /&gt; from Events&lt;br /&gt;) x&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Results&lt;br /&gt;&lt;br /&gt;EventID     Hours       Minutes     Seconds     &lt;br /&gt;----------- ----------- ----------- ----------- &lt;br /&gt;1           6           11          22&lt;br /&gt;2           7           42          29&lt;br /&gt;3           0           21          6&lt;br /&gt;4           3           51          21&lt;br /&gt;5           1           15          53&lt;br /&gt;6           5           24          0&lt;br /&gt;7           16          50          2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Calculating Duration Totals&lt;br /&gt;&lt;br /&gt;select &lt;br /&gt;    sum(TotalSeconds / 3600) as Hours, &lt;br /&gt;    sum((TotalSeconds % 3600) / 60) as Minutes, &lt;br /&gt;    sum(TotalSeconds % 60) as Seconds&lt;br /&gt;from&lt;br /&gt;(&lt;br /&gt;    select EventID, DateDiff(second, StartDate, EndDate) as TotalSeconds &lt;br /&gt;    from Events&lt;br /&gt;) x&lt;br /&gt;&lt;br /&gt;Hours       Minutes     Seconds     &lt;br /&gt;----------- ----------- ----------- &lt;br /&gt;38          214         133&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select &lt;br /&gt;  sum(TotalSeconds) / 86400 as Days,&lt;br /&gt;  (sum(TotalSeconds) % 86400) / 3600 as Hours, &lt;br /&gt;  (sum(TotalSeconds) % 3600) / 60 as Minutes, &lt;br /&gt;  sum(TotalSeconds) % 60 as Seconds&lt;br /&gt;from&lt;br /&gt;(&lt;br /&gt;    select EventID, DateDiff(second, StartDate, EndDate) as TotalSeconds &lt;br /&gt;    from Events&lt;br /&gt;) x&lt;br /&gt;&lt;br /&gt;Days        Hours       Minutes     Seconds     &lt;br /&gt;----------- ----------- ----------- ----------- &lt;br /&gt;1           17          36          13&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-508897612535200930?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/508897612535200930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=508897612535200930&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/508897612535200930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/508897612535200930'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/converting-time-units-with-math.html' title='Converting Time Units With Math'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-2849469465053937165</id><published>2008-09-05T01:34:00.000-07:00</published><updated>2008-09-05T01:35:45.826-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Ajax Auto complete Extender webservice</title><content type='html'>Sample Code in the Webservice&lt;br /&gt;&lt;br /&gt;   public String[] FillList(string prefixText, int count)&lt;br /&gt;   {&lt;br /&gt;        SqlCommand cmd = new SqlCommand("select distinct BugTitle from bugmaster where bugtitle like '" + prefixText.Replace("'", "''") + "%'", new clsGroConnection().getOpenCon());&lt;br /&gt;        SqlDataAdapter da = new SqlDataAdapter(cmd);&lt;br /&gt;        int nn_itmCount;&lt;br /&gt;        DataTable dt=new DataTable("renju");&lt;br /&gt;        da.Fill(dt);&lt;br /&gt;        ArrayList arr = new ArrayList();&lt;br /&gt;        for (nn_itmCount = 0; nn_itmCount &lt; ((dt.Rows.Count &gt;= 100) ? 10 : dt.Rows.Count); nn_itmCount++)&lt;br /&gt;        {&lt;br /&gt;            arr.Add(dt.Rows[nn_itmCount]["BugTitle"]);&lt;br /&gt;        }&lt;br /&gt;        return (String[])arr.ToArray(typeof(string));&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-2849469465053937165?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/2849469465053937165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=2849469465053937165&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2849469465053937165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/2849469465053937165'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/ajax-auto-complete-extender-webservice.html' title='Ajax Auto complete Extender webservice'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-7789098695481247667</id><published>2008-09-04T23:17:00.000-07:00</published><updated>2008-09-05T22:28:52.427-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>STUFF vs REPLACE</title><content type='html'>(see PIVOT Table Post for its usage)&lt;br /&gt;&lt;br /&gt;STUFF - Deletes a specified length of characters and inserts another set of characters at a specified starting point. &lt;br /&gt;SELECT STUFF('abcdef', 2, 3, 'ijklmn')&lt;br /&gt;GO&lt;br /&gt;Here is the result set:&lt;br /&gt;--------- &lt;br /&gt;aijklmnef &lt;br /&gt;REPLACE - Replaces all occurrences of the second given string expression in the first string expression with a third expression.&lt;br /&gt;SELECT REPLACE('abcdefghicde','cde','xxx')&lt;br /&gt;GO &lt;br /&gt;Here is the result set: &lt;br /&gt;------------&lt;br /&gt;abxxxfghixxx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-7789098695481247667?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/7789098695481247667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=7789098695481247667&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7789098695481247667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7789098695481247667'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/stuff-vs-replace.html' title='STUFF vs REPLACE'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-7071737723047655885</id><published>2008-09-04T23:10:00.000-07:00</published><updated>2008-09-04T23:11:30.865-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Delete the rows which are duplicate (don’t delete both duplicate records)</title><content type='html'>SET ROWCOUNT 1&lt;br /&gt;DELETE yourtable&lt;br /&gt;FROM yourtable a&lt;br /&gt;WHERE (SELECT COUNT(*) FROM yourtable b WHERE b.name1 = a.name1 AND b.age1 = a.age1) &gt; 1&lt;br /&gt;WHILE @@rowcount &gt; 0&lt;br /&gt;  DELETE yourtable&lt;br /&gt;  FROM yourtable a&lt;br /&gt;  WHERE (SELECT COUNT(*) FROM yourtable b WHERE b.name1 = a.name1 AND b.age1 = a.age1) &gt; 1&lt;br /&gt;SET ROWCOUNT 0&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-7071737723047655885?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/7071737723047655885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=7071737723047655885&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7071737723047655885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7071737723047655885'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/delete-rows-which-are-duplicate-dont.html' title='Delete the rows which are duplicate (don’t delete both duplicate records)'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-6669698815337936302</id><published>2008-09-04T22:54:00.000-07:00</published><updated>2008-09-08T01:35:58.683-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Table's row count-you can use alternative way instead of SELECT COUNT(*)</title><content type='html'>Because SELECT COUNT(*) statement make a full table scan to return the total table's row count, it can take very many time for the large table. There is another way to determine the total row count in a table. You can use sysindexes system table, in this case. There is ROWS column in the sysindexes table. This column contains the total row count for each table in your database. So, you can use the following select statement instead of SELECT COUNT(*): &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SELECT rows FROM sysindexes WHERE id = OBJECT_ID('table_name') AND indid &lt; 2&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt; So, you can improve the speed of such queries in several times. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.renjucool.co.nr"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-6669698815337936302?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/6669698815337936302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=6669698815337936302&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6669698815337936302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6669698815337936302'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/tables-row-count-you-can-use.html' title='Table&apos;s row count-you can use alternative way instead of SELECT COUNT(*)'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4253665427074646314</id><published>2008-09-04T22:34:00.001-07:00</published><updated>2008-09-04T22:35:42.503-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Bubble Sort Algorithm in C#</title><content type='html'>static int[] bubbleSort(int[] numbers, int array_size)&lt;br /&gt;        {&lt;br /&gt;            int i, j, temp;&lt;br /&gt;&lt;br /&gt;            for (i = (array_size - 1); i &gt;= 0; i--)&lt;br /&gt;            {&lt;br /&gt;                for (j = 1; j &lt;= i; j++)&lt;br /&gt;                {&lt;br /&gt;                    if (numbers[j - 1] &gt; numbers[j])&lt;br /&gt;                    { &lt;br /&gt;                        temp = numbers[j - 1];&lt;br /&gt;                        numbers[j - 1] = numbers[j];&lt;br /&gt;                        numbers[j] = temp;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;           return numbers;&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4253665427074646314?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4253665427074646314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4253665427074646314&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4253665427074646314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4253665427074646314'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/bubble-sort-algorithm-in-c_04.html' title='Bubble Sort Algorithm in C#'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-6877030142150630952</id><published>2008-09-04T22:32:00.000-07:00</published><updated>2008-09-04T22:43:18.525-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Returning multiple values from a Function</title><content type='html'>public static int add(int a, int b, ref int c)&lt;br /&gt;        {&lt;br /&gt;            c = a + 2;&lt;br /&gt;            return a + b;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;We can use out and ref,can be called as shown below&lt;br /&gt;&lt;br /&gt;int e = add(2, 3, ref d);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-6877030142150630952?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/6877030142150630952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=6877030142150630952&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6877030142150630952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/6877030142150630952'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/returning-multiple-values-from-function.html' title='Returning multiple values from a Function'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5919784271540171325</id><published>2008-09-04T22:26:00.000-07:00</published><updated>2008-09-04T22:28:04.137-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>How to format a Date or DateTime in SQL Server</title><content type='html'>Question: How do you create a DateTime in a specific format in SQL Server?&lt;br /&gt;&lt;br /&gt;Answer:  You don't. You can't.   The only way to translate a DateTime into a specific format is to convert it to a VARCHAR or other "string" data type.  This means that it is no longer a DateTime.  It is a VARCHAR. &lt;br /&gt;&lt;br /&gt;This might not be the answer you are looking for, but please ... don't stop reading!&lt;br /&gt;&lt;br /&gt;. . .&lt;br /&gt;&lt;br /&gt;Why do people have trouble with the concept of raw data versus the presentation of that data?  Am I missing something?  If you use CONVERT() in an attempt format your DateTime data, surely people must understand that CONVERT() also converts that data from a DateTime to another data type?  It's right there in the expression:&lt;br /&gt;&lt;br /&gt; SELECT CONVERT(varchar(10), someDate)&lt;br /&gt;&lt;br /&gt;That clearly is CONVERTing someDate to a varchar(10), isn't it?   What gets returned when you convert something to a VARCHAR, a date or a string?  The answer is a string of meaningless characters that no longer have any value as an actual date.&lt;br /&gt;&lt;br /&gt;"You clearly are a hack, Jeff," you tell me, "since it is very easy for a SQL-Master such as myself to format dates without converting them to strings.  For example, check this out this sweet 'mm/dd/yyyy' format:  &lt;br /&gt;&lt;br /&gt;select right('0' + rtrim(month(@d)),2) + '/' + right('0' + rtrim(day(@d)),2) + '/' + rtrim(year(@d)).&lt;br /&gt;&lt;br /&gt;I can write stuff like this all week! It's easy.  You've got much to learn!"&lt;br /&gt;&lt;br /&gt;Well, I have bad news for you. That still is implicitly converting everything to a string -- the rtrim() function is handling that part.  This is even worse than doing it explicitly with a CONVERT() function, and the end result is not easy to read or work with or write, it is not efficient, and it is still not returning a DateTime value.&lt;br /&gt;&lt;br /&gt;. . .&lt;br /&gt;&lt;br /&gt;Always remember:  If a value is not a DateTime datatype, it is not  a date.  No matter what it looks like, or how neatly formatted you made that string, or how careful you were to use an ISO compliant format, it is not a Date.  Period.&lt;br /&gt;&lt;br /&gt;It is crucial to understand this, and to thus to understand the implications of trying to "format" data at the database layer.  It cannot be done!  All you can do is convert things to generic "string" datatypes.   That's it.&lt;br /&gt;&lt;br /&gt;. . .&lt;br /&gt;&lt;br /&gt;No matter what they may look like, strings don't sort like dates. They don't compare like dates.  You can't get the month from a string consistently, or calculate the amount of minutes between two strings, or add x days to a string.  You can't ensure that different databases or stored procedures or functions or applications will always interpret your chosen date formatted string the same.  Client applications -- who should be doing the formatting -- cannot apply date formatting to a string, they need an actual date stored in the correct data type.  Thus, they would need to convert this string back to a DateTime type and only then can they format it for display purposes or use standard date calculations on the value.  Does it really make sense to start with a date value, convert it to a string in SQL, and then have your client convert it back to a date value?&lt;br /&gt;&lt;br /&gt;Simply return raw data from your database using the proper data types, and then simply use the tools designed to handle raw data in the correct types at your clients to format and present that data. &lt;br /&gt;&lt;br /&gt;    * In crystal reports or other reporting tools, you can just drop your nice, clean, raw unformatted datetime value on your report, right-click it, and easily format it any way you want.  You can use regional settings, specify mm/dd/yyyy format strings, and all kinds of options.  It's simple and easy, but you must return datetime values back from SQL, not VARCHARS!&lt;br /&gt;    * In Excel, again, you can simply right-click and choose any format you want, or create your own.&lt;br /&gt;    * In .NET applications, you can usually format dates in data bound controls using the GUI interface, and you can also format things using the ToString() method of a true datetime value and specify all kinds of simple yet flexible formatting strings.&lt;br /&gt;    * In ASP.NET web pages, just about all data bound web controls let you specify a FormatString property for your bound columns, giving you clear, simple control over exactly how your dates look.&lt;br /&gt;    * In VB and VBA, there is a Format() function that again works with named formats or custom format strings.&lt;br /&gt;    * In MS Access, the report and form designer lets you format any text box containing a datetime value any way you want, again with simple format names or format strings, and you have all of the VBA functions available to format dates in your code.  You can even specify the specific date format for columns in a query in the query designer -- but, again, you must be working with data in the correct datetime data type.&lt;br /&gt;&lt;br /&gt;Isn't it much easier to simply right-click on something and then enter a simple "mmm dd, yyyy" format string instead of building and parsing this manually using CONVERT and SUBSTRING parsing in T-SQL?  Isn't it more flexible to do all formatting at your presentation layer so that you can just return data from your database and not worry about how it looks?  Then 5 different clients can query the same stored procedure and each output those dates any way they want -- without changing any database code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5919784271540171325?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5919784271540171325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5919784271540171325&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5919784271540171325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5919784271540171325'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/how-to-format-date-or-datetime-in-sql.html' title='How to format a Date or DateTime in SQL Server'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-7822434739145951635</id><published>2008-09-04T22:24:00.000-07:00</published><updated>2008-09-05T22:28:52.427-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Sql Server TimeSpan</title><content type='html'>With those functions in place, we can add two more that will give us further flexibility when working with dates and times: The concept of a "TimeSpan", very similar to what is available in the .NET framework.&lt;br /&gt;&lt;br /&gt;create function TimeSpan(@Days int, @Hours int, @Minutes int, @Seconds int)&lt;br /&gt;-- returns a datetime the specified # of days/hours/minutes/seconds from the "base" date of 1/1/1900 (a "TimeSpan")&lt;br /&gt;returns datetime&lt;br /&gt;as&lt;br /&gt;    begin&lt;br /&gt;    return dbo.Time(@Hours,@Minutes,@Seconds) + @Days&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;create function TimeSpanUnits(@Unit char(1), @TimeSpan datetime)&lt;br /&gt;-- returns the # of units specified in the TimeSpan.&lt;br /&gt;-- The Unit parameter can be: "d" = days, "h" = hours, "m" = minutes, "s" = seconds&lt;br /&gt;returns int&lt;br /&gt;as&lt;br /&gt;    begin&lt;br /&gt;    return case @Unit&lt;br /&gt;        when 'd' then datediff(day, 0, @TimeSpan)&lt;br /&gt;        when 'h' then datediff(hour, 0, @TimeSpan)&lt;br /&gt;        when 'm' then datediff(minute, 0, @TimeSpan)&lt;br /&gt;        when 's' then datediff(second, 0, @TimeSpan)&lt;br /&gt;        else Null end&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;Here, a TimeSpan is just a datetime offset from the "base" date of 1/1/1900.  Creating one is the same as creating a Time using the Time() function, but we have added a parameter for Days to give more flexibility.&lt;br /&gt;&lt;br /&gt;The TimeSpanUnits() function works similar to standard T-SQL DatePart() function, but it returns the total # of units in the given time span.  So, if you create a time span of 1 day and 2 hours, then TimeSpanUnits("d") will return 1 and TimeSpanUnits("h") will return 26.  Negative values can be returned as well.  You also may wish to implement the TimeSpanUnits() function as multiple functions, one per unit (e.g., TimeSpanHours(), TimeSpanDays(), etc) depending on your preference.&lt;br /&gt;&lt;br /&gt;Of course, a simple way to create a TimeSpan is to simply subtract two standard T-SQL DateTimes.  Also please note that we can add and subtract Dates, Times, and TimeSpans all together using standard + and - operators and everything will work as expected.  We can also add integers to our Dates and Times which will add entire days to the values.&lt;br /&gt;&lt;br /&gt;Here's a TimeSpan usage example:&lt;br /&gt;&lt;br /&gt;declare @Deadline datetime -- remember, we still use standard datetimes for everything, include TimeSpans&lt;br /&gt;set @Deadline = dbo.TimeSpan(2,0,0,0)   -- the deadline is two days&lt;br /&gt;&lt;br /&gt;declare @CreateDate datetime&lt;br /&gt;declare @ResponseDate datetime&lt;br /&gt;&lt;br /&gt;set @CreateDate = dbo.DateTime(2006,1,3,8,30,0)  -- Jan 3, 2006, 8:30 AM&lt;br /&gt;set @ResponseDate = getdate() -- today&lt;br /&gt;&lt;br /&gt;-- See if the response date is past the deadline:&lt;br /&gt;select case when @ResponseDate &gt; @CreateDate + @Deadline then 'overdue.' else 'on time.' end as Result&lt;br /&gt;&lt;br /&gt;-- Find out how many total hours it took to respond:  &lt;br /&gt;declare @TimeToRepond datetime&lt;br /&gt;set @TimeToRespond = @ResponseDate - @CreateDate&lt;br /&gt;&lt;br /&gt;select dbo.TimeSpanUnits('h', @TimeToRespond) as ResponseTotalHours&lt;br /&gt;&lt;br /&gt;-- Return the response time as # of days, # of hours, # of minutes:&lt;br /&gt;select dbo.TimeSpanUnits('d',@TimeToRespond) as Days, DatePart(hour, @TimeToRespond) as Hours, DatePart(minute, @TimeToRespond) as Minutes&lt;br /&gt;&lt;br /&gt;-- Return two days and two hours from now:&lt;br /&gt;select getdate() + dbo.TimeSpan(2,2,0,0)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-7822434739145951635?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/7822434739145951635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=7822434739145951635&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7822434739145951635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7822434739145951635'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/sql-server-timespan.html' title='Sql Server TimeSpan'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5681144994240651688</id><published>2008-09-04T22:22:00.000-07:00</published><updated>2008-09-05T22:28:52.427-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>SQL Server Date, Time and DateTime Functions</title><content type='html'>create  function DateOnly(@DateTime DateTime)&lt;br /&gt;-- Returns @DateTime at midnight; i.e., it removes the time portion of a DateTime value.&lt;br /&gt;returns datetime&lt;br /&gt;as&lt;br /&gt;    begin&lt;br /&gt;    return dateadd(dd,0, datediff(dd,0,@DateTime))&lt;br /&gt;    end&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;create function Date(@Year int, @Month int, @Day int)&lt;br /&gt;-- returns a datetime value for the specified year, month and day&lt;br /&gt;-- Thank you to Michael Valentine Jones for this formula (see comments).&lt;br /&gt;returns datetime&lt;br /&gt;as&lt;br /&gt;    begin&lt;br /&gt;    return dateadd(month,((@Year-1900)*12)+@Month-1,@Day-1)&lt;br /&gt;    end&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;create function Time(@Hour int, @Minute int, @Second int)&lt;br /&gt;-- Returns a datetime value for the specified time at the "base" date (1/1/1900)&lt;br /&gt;-- Many thanks to MVJ for providing this formula (see comments).&lt;br /&gt;returns datetime&lt;br /&gt;as&lt;br /&gt;    begin&lt;br /&gt;    return dateadd(ss,(@Hour*3600)+(@Minute*60)+@Second,0)&lt;br /&gt;    end&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;create function TimeOnly(@DateTime DateTime)&lt;br /&gt;-- returns only the time portion of a DateTime, at the "base" date (1/1/1900)&lt;br /&gt;returns datetime&lt;br /&gt;as&lt;br /&gt;    begin&lt;br /&gt;    return @DateTime - dbo.DateOnly(@DateTime)&lt;br /&gt;    end&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;create function DateTime(@Year int, @Month int, @Day int, @Hour int, @Minute int, @Second int)&lt;br /&gt;-- returns a dateTime value for the date and time specified.&lt;br /&gt;returns datetime&lt;br /&gt;as&lt;br /&gt;    begin&lt;br /&gt;    return dbo.Date(@Year,@Month,@Day) + dbo.Time(@Hour, @Minute,@Second)&lt;br /&gt;    end&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;Remember that you must prefix UDFs with the owner (usually dbo) when calling them.&lt;br /&gt;&lt;br /&gt;Usage Examples:&lt;br /&gt;&lt;br /&gt;    *  where TransactionDate &gt;= dbo.Date(2005,1,2)  -- no formatting or implicit string conversions needed for date literals&lt;br /&gt;&lt;br /&gt;    * select dbo.Date(year(getdate()), 1,1) -- returns the first day of the year for the current year.&lt;br /&gt;&lt;br /&gt;    * select dbo.DateOnly(getdate()) -- returns only the date portion of the current day.&lt;br /&gt;&lt;br /&gt;    * if dbo.TimeOnly(SomeDate) = dbo.Time(5,30,0)  -- check to see if the time for a given date is at 5:30 AM&lt;br /&gt;&lt;br /&gt;    * select dbo.Date(year(getdate()), month(getdate()),1) -- returns the first day of the current month.&lt;br /&gt;&lt;br /&gt;    * select dbo.Date(year(getdate()), month(getdate())+1,0) -- returns the last day of the current month.&lt;br /&gt;&lt;br /&gt;    * where SomeDate &gt;= dbo.DateOnly(getdate()) and SomeDate &lt; dbo.DateOnly(getDate())+1 -- a simple way to get all transactions that occurred on the current date&lt;br /&gt;&lt;br /&gt;    * select dbo.DateOnly(getdate()) + 1 + dbo.Time(14,30,0) -- returns tomorrow at 2:30 PM.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5681144994240651688?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5681144994240651688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5681144994240651688&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5681144994240651688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5681144994240651688'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/sql-server-date-time-and-datetime.html' title='SQL Server Date, Time and DateTime Functions'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4437578530753592281</id><published>2008-09-04T21:05:00.000-07:00</published><updated>2008-09-05T22:28:52.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Joins,Groupby,Datetime Stored Procedures(REFERENCE)</title><content type='html'>set ANSI_NULLS ON&lt;br /&gt;set QUOTED_IDENTIFIER ON&lt;br /&gt;GO&lt;br /&gt;-- =============================================&lt;br /&gt;-- Author:  Renju.R&lt;br /&gt;-- Create date: August 1,2008&lt;br /&gt;-- Description: &lt;br /&gt;-- =============================================&lt;br /&gt;ALTER procedure [dbo].[GetEmpPerformance]&lt;br /&gt;@fromDate datetime,&lt;br /&gt;@toDate datetime&lt;br /&gt;--@projectId int,&lt;br /&gt;--@moduleId int&lt;br /&gt;as&lt;br /&gt;begin&lt;br /&gt;select  ws.currentStatus,am.activityName,&lt;br /&gt;w.workID,w.work,w.startDate,w.finishDate,w.formId,w.activityId,&lt;br /&gt;ts.activityId,sum(ts.hoursInActivity),sum(ts.minInActivity),&lt;br /&gt;(select UserName from dbo.UserRegMaster where UserID=w.toUser) as ToUser,&lt;br /&gt;--dbo.GetWorkHours(@fromDate, @toDate) TotalWorkingHours,&lt;br /&gt;sum(DATEDIFF(hour,w.startDate,w.finishDate)) as WorkHours,&lt;br /&gt;sum(DATEDIFF(minute,w.startDate,w.finishDate) - (DATEDIFF(hour,w.startDate,w.finishDate) * 60)) as WorkMinutes&lt;br /&gt;from work w &lt;br /&gt;left outer join dbo.workStatus ws on ws.workID=w.workID &lt;br /&gt;and statusDate=(select max(statusDate) from workStatus where workId=w.workID)&lt;br /&gt;left outer join dbo.TimeSheet ts&lt;br /&gt; on ts.activityId=w.activityId and &lt;br /&gt;ts.workID=w.workID&lt;br /&gt;left outer join dbo.ActivityMaster am on ts.activityId=am.activityId and ts.workID=w.workID&lt;br /&gt;where  --projID=@projectId and modID=@projectId and &lt;br /&gt;startDate between &lt;br /&gt;convert(datetime,@fromDate,101) and convert(datetime,@toDate,101)  group by  &lt;br /&gt;ws.currentStatus,am.activityName,&lt;br /&gt;w.workID,w.work,w.startDate,w.finishDate,w.formId,w.activityId,&lt;br /&gt;ts.activityId,ToUser&lt;br /&gt;end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4437578530753592281?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4437578530753592281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4437578530753592281&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4437578530753592281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4437578530753592281'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/joinsgroupbydatetime-stored.html' title='Joins,Groupby,Datetime Stored Procedures(REFERENCE)'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-5711137548717017936</id><published>2008-09-04T05:27:00.000-07:00</published><updated>2008-09-05T22:29:57.373-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Looping and inserting values to Datatable</title><content type='html'>public DataTable ModifyData(DataSet dsMod)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;int rCount = 0;&lt;br /&gt;string temp2 = "";&lt;br /&gt;DataTable dtNew = new DataTable();&lt;br /&gt;DataTable dt = dsMod.Tables[0];&lt;br /&gt;DataRow dr;&lt;br /&gt;for (int k = 0; k &lt;= dt.Columns.Count - 1; k++)&lt;br /&gt;{&lt;br /&gt;string cname = dt.Columns[k].ColumnName;&lt;br /&gt;dtNew.Columns.Add(cname);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;foreach (DataRow dataRow in dt.Rows)&lt;br /&gt;{&lt;br /&gt;int cnt = 0;&lt;br /&gt;dr = dtNew.NewRow();&lt;br /&gt;dtNew.Rows.Add(dr);&lt;br /&gt;foreach (DataColumn dataColumn in dt.Columns)&lt;br /&gt;{&lt;br /&gt;string t1 = dataRow[dataColumn].ToString();&lt;br /&gt;if (Convert.ToString(dataColumn) != "Name")&lt;br /&gt;{&lt;br /&gt;if (t1 == "")&lt;br /&gt;{&lt;br /&gt;temp2 = "";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;temp2 = clsCommon.MinutesToHours(Convert.ToInt32(t1));&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;temp2 = t1;&lt;br /&gt;}&lt;br /&gt;dtNew.Rows[rCount][cnt] = temp2.ToString();&lt;br /&gt;cnt++;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;rCount++;&lt;br /&gt;}&lt;br /&gt;return dtNew;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-5711137548717017936?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/5711137548717017936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=5711137548717017936&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5711137548717017936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/5711137548717017936'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/looping-and-inserting-values-to.html' title='Looping and inserting values to Datatable'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-546837410257392493</id><published>2008-09-04T05:24:00.002-07:00</published><updated>2008-09-04T22:14:25.858-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Exporting DataTable to Excel</title><content type='html'>private void ExportToExcel(DataTable dtIn)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;DataTable dt = dtIn;&lt;br /&gt;if (dt != null)&lt;br /&gt;{&lt;br /&gt;Response.Clear();&lt;br /&gt;Response.AddHeader("Content-Disposition", "attachment;filename=FileName.xls");&lt;br /&gt;Response.Charset = "";&lt;br /&gt;Response.ContentType = "application/vnd.ms-excel";&lt;br /&gt;string tab = "";&lt;br /&gt;foreach (DataColumn dc in dt.Columns)&lt;br /&gt;{&lt;br /&gt;Response.Write(tab + dc.ColumnName);&lt;br /&gt;tab = "\t";&lt;br /&gt;}&lt;br /&gt;Response.Write("\n");&lt;br /&gt;int i;&lt;br /&gt;foreach (DataRow dr in dt.Rows)&lt;br /&gt;{&lt;br /&gt;tab = "";&lt;br /&gt;for (i = 0; i &lt; dt.Columns.Count; i++)&lt;br /&gt;{&lt;br /&gt;Response.Write(tab + dr[i].ToString());&lt;br /&gt;tab = "\t";&lt;br /&gt;}&lt;br /&gt;Response.Write("\n");&lt;br /&gt;}&lt;br /&gt;Response.End();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-546837410257392493?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/546837410257392493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=546837410257392493&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/546837410257392493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/546837410257392493'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/exporting-datatable-to-excel.html' title='Exporting DataTable to Excel'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-7982187367631759852</id><published>2008-09-04T05:24:00.001-07:00</published><updated>2008-09-04T22:43:18.525-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Dynamic DataGrid Templates</title><content type='html'>public void DynamicGrid()&lt;br /&gt;{&lt;br /&gt;DataGrid dg = new DataGrid();&lt;br /&gt;DataSet ds = objws.getempinactivity(1, 8, DateTime.Now.AddDays(-50), DateTime.Now);&lt;br /&gt;DataTable dt = ds.Tables[0];&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &lt;= dt.Columns.Count - 1; i++)&lt;br /&gt;{&lt;br /&gt;TemplateColumn templateColumn = new TemplateColumn();&lt;br /&gt;string columnName = dt.Columns[i].ColumnName;&lt;br /&gt;templateColumn.HeaderTemplate = new DataGridTemplate(ListItemType.Header, columnName);&lt;br /&gt;for (int j = 0; j &lt;= dt.Rows.Count - 1; j++)&lt;br /&gt;{&lt;br /&gt;string value = dt.Rows[j][i].ToString();&lt;br /&gt;templateColumn.ItemTemplate = new DataGridTemplate(ListItemType.Item, value);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;DataGrid1.Columns.Add(templateColumn);&lt;br /&gt;}&lt;br /&gt;DataGrid1.DataSource = ds;&lt;br /&gt;DataGrid1.DataBind();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;&lt;br /&gt;/// &lt;br /&gt;/// RENJU.R&lt;br /&gt;/// Summary description for DataGridTemplate&lt;br /&gt;/// &lt;br /&gt;public class DataGridTemplate : ITemplate&lt;br /&gt;{&lt;br /&gt;ListItemType templateType;&lt;br /&gt;string columnName;&lt;br /&gt;public DataGridTemplate(ListItemType type, string colname)&lt;br /&gt;{&lt;br /&gt;//&lt;br /&gt;// TODO: Add constructor logic here&lt;br /&gt;//&lt;br /&gt;templateType = type;&lt;br /&gt;columnName = colname;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;public void InstantiateIn(System.Web.UI.Control container)&lt;br /&gt;{&lt;br /&gt;Literal lc = new Literal();&lt;br /&gt;switch (templateType)&lt;br /&gt;{&lt;br /&gt;case ListItemType.Header:&lt;br /&gt;lc.Text = "" + columnName + "";&lt;br /&gt;container.Controls.Add(lc);&lt;br /&gt;break;&lt;br /&gt;case ListItemType.Item:&lt;br /&gt;lc.Text = columnName;&lt;br /&gt;container.Controls.Add(lc);&lt;br /&gt;break;&lt;br /&gt;case ListItemType.EditItem:&lt;br /&gt;TextBox tb = new TextBox();&lt;br /&gt;tb.Text = "";&lt;br /&gt;container.Controls.Add(tb);&lt;br /&gt;break;&lt;br /&gt;case ListItemType.Footer:&lt;br /&gt;lc.Text = "" + columnName + "";&lt;br /&gt;container.Controls.Add(lc);&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;//public void InstantiateIn(Control container)&lt;br /&gt;//{&lt;br /&gt;// LiteralControl l = new LiteralControl();&lt;br /&gt;// l.DataBinding += new EventHandler(this.OnDataBinding);&lt;br /&gt;// container.Controls.Add(l);&lt;br /&gt;//}&lt;br /&gt;&lt;br /&gt;//public void OnDataBinding(object sender, EventArgs e)&lt;br /&gt;//{&lt;br /&gt;// LiteralControl l = (LiteralControl)sender;&lt;br /&gt;// DataGridItem container = (DataGridItem)l.NamingContainer;&lt;br /&gt;// l.Text = ((DataRowView)container.DataItem)[colname].ToString();&lt;br /&gt;//}&lt;br /&gt;} &lt;br /&gt;Poste&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-7982187367631759852?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/7982187367631759852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=7982187367631759852&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7982187367631759852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/7982187367631759852'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/dynamic-datagrid-templates.html' title='Dynamic DataGrid Templates'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4796014560603466523</id><published>2008-09-04T05:23:00.001-07:00</published><updated>2008-09-04T21:22:24.646-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Sql Server Pivot Table</title><content type='html'>set ANSI_NULLS ON&lt;br /&gt;set QUOTED_IDENTIFIER ON&lt;br /&gt;GO&lt;br /&gt;-- =============================================&lt;br /&gt;-- Author: Renju.R&lt;br /&gt;-- Create date: August 5,2008&lt;br /&gt;-- Description: Cross Tabbing Tables&lt;br /&gt;-- =============================================&lt;br /&gt;ALTER procedure [dbo].[crosstab]&lt;br /&gt;@select varchar(8000),&lt;br /&gt;@sumfunc varchar(100),&lt;br /&gt;@pivot varchar(100),&lt;br /&gt;@table varchar(100)&lt;br /&gt;as&lt;br /&gt;begin&lt;br /&gt;declare @sql varchar(8000), @delim varchar(1)&lt;br /&gt;set nocount on&lt;br /&gt;set ansi_warnings off&lt;br /&gt;exec ('select ' + @pivot + ' as pivot into ##pivot from ' + @table + ' where 1=2')&lt;br /&gt;exec ('insert into ##pivot select distinct ' + @pivot + ' from ' + @table + ' where '&lt;br /&gt;+ @pivot + ' is not null')&lt;br /&gt;select @sql='', @sumfunc=stuff(@sumfunc, len(@sumfunc), 1, ' end)' )&lt;br /&gt;select @delim=case sign( charindex('char', data_type)+charindex('date', data_type) )&lt;br /&gt;when 0 then '' else '''' end&lt;br /&gt;from tempdb.information_schema.columns&lt;br /&gt;where table_name='##pivot' and column_name='pivot'&lt;br /&gt;select @sql=@sql + '''' + convert(varchar(100), pivot) + ''' = ' +&lt;br /&gt;stuff(@sumfunc,charindex( '(', @sumfunc )+1, 0, ' case ' + @pivot + ' when '&lt;br /&gt;+ @delim + convert(varchar(100), pivot) + @delim + ' then ' ) + ', ' from ##pivot&lt;br /&gt;drop table ##pivot&lt;br /&gt;select @sql=left(@sql, len(@sql)-1)&lt;br /&gt;select @select=stuff(@select, charindex(' from ', @select)+1, 0, ', ' + @sql + ' ')&lt;br /&gt;exec (@select)&lt;br /&gt;end&lt;br /&gt;set ansi_warnings on&lt;br /&gt;&lt;br /&gt;For Executing the procedure some Examples are as below&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;set ANSI_NULLS ON&lt;br /&gt;set QUOTED_IDENTIFIER ON&lt;br /&gt;GO&lt;br /&gt;ALTER procedure [dbo].[EvaluationFormWise]&lt;br /&gt;as&lt;br /&gt;begin&lt;br /&gt;execute crosstab&lt;br /&gt;'select pm.ProjectName,mm.ModuleName,fm.formName,fm.formType,&lt;br /&gt;sm.SeverityName from bugmaster bm&lt;br /&gt;inner join formmaster fm on fm.formId=bm.formid&lt;br /&gt;inner join dbo.SeverityMaster sm on sm.SeverityID=bm.SeverityID&lt;br /&gt;inner join dbo.ProjectMaster pm on pm.projectId=bm.projectId&lt;br /&gt;inner join dbo.ModuleMaster mm on mm.moduleId=bm.moduleid&lt;br /&gt;left outer join UserRegMaster um on um.userid=bm.programmerId&lt;br /&gt;left outer join UserRegMaster urm on urm.userid=bm.submitterid&lt;br /&gt;group by pm.ProjectName,mm.ModuleName,fm.formName,fm.formType,sm.SeverityName',&lt;br /&gt;'count(bm.SeverityID)',&lt;br /&gt;'SeverityName',&lt;br /&gt;'SeverityMaster'&lt;br /&gt;end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4796014560603466523?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4796014560603466523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4796014560603466523&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4796014560603466523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4796014560603466523'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/sql-server-pivot-table.html' title='Sql Server Pivot Table'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-8408378768168983177</id><published>2008-09-04T05:22:00.000-07:00</published><updated>2009-11-15T02:01:11.848-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>Asp.Net Message Box</title><content type='html'>using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Text;&lt;br /&gt;&lt;br /&gt;/// &lt;br /&gt;/// Summary description for MessageBox&lt;br /&gt;/// &lt;br /&gt;/// Done by RENJU.R&lt;br /&gt;/// You are licenced to distribute the code&lt;br /&gt;/// http://www.renjucool.co.nr&lt;br /&gt;&lt;br /&gt;public class MessageBox&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;private static Hashtable m_executingPages = new Hashtable();&lt;br /&gt;private MessageBox() { }&lt;br /&gt;public static void Show(string sMessage)&lt;br /&gt;{&lt;br /&gt;if (!m_executingPages.Contains(HttpContext.Current.Handler))&lt;br /&gt;{&lt;br /&gt;Page executingPage = HttpContext.Current.Handler as Page;&lt;br /&gt;if (executingPage != null)&lt;br /&gt;{&lt;br /&gt;Queue messageQueue = new Queue();&lt;br /&gt;messageQueue.Enqueue(sMessage);&lt;br /&gt;m_executingPages.Add(HttpContext.Current.Handler, messageQueue);&lt;br /&gt;executingPage.Unload += new EventHandler(ExecutingPage_Unload);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;Queue queue = (Queue)m_executingPages[HttpContext.Current.Handler];&lt;br /&gt;queue.Enqueue(sMessage);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private static void ExecutingPage_Unload(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;Queue queue = (Queue)m_executingPages[HttpContext.Current.Handler];&lt;br /&gt;if (queue != null)&lt;br /&gt;{&lt;br /&gt;StringBuilder sb = new StringBuilder();&lt;br /&gt;int iMsgCount = queue.Count;&lt;br /&gt;sb.Append("");&lt;br /&gt;m_executingPages.Remove(HttpContext.Current.Handler);&lt;br /&gt;HttpContext.Current.Response.Write(sb.ToString());&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-8408378768168983177?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/8408378768168983177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=8408378768168983177&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/8408378768168983177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/8408378768168983177'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/aspnet-message-box.html' title='Asp.Net Message Box'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4655967335608256496</id><published>2008-09-04T05:21:00.000-07:00</published><updated>2008-09-04T21:22:24.646-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server'/><title type='text'>Sql Server getting date difference in hours,min,sec</title><content type='html'>set ANSI_NULLS ON&lt;br /&gt;set QUOTED_IDENTIFIER ON&lt;br /&gt;GO&lt;br /&gt;-- =============================================&lt;br /&gt;-- Author: Renju.R&lt;br /&gt;-- Create date: July 31&lt;br /&gt;-- Description: getting date difference in hours,min,sec&lt;br /&gt;-- =============================================&lt;br /&gt;ALTER FUNCTION [dbo].[GetDateDiff]&lt;br /&gt;(&lt;br /&gt;@startDate datetime,&lt;br /&gt;@finishDate datetime&lt;br /&gt;)&lt;br /&gt;RETURNS TABLE&lt;br /&gt;AS&lt;br /&gt;RETURN&lt;br /&gt;(&lt;br /&gt;SELECT DATEDIFF(hour,@startDate,@finishDate) as TotalHours,&lt;br /&gt;DATEDIFF(minute,@startDate,@finishDate) - (DATEDIFF(hour,@startDate,@finishDate) * 60) as TotalMinutes,&lt;br /&gt;DATEDIFF(second,@startDate,@finishDate) - (DATEDIFF(minute,@startDate,@finishDate) * 60) as TotalSeconds&lt;br /&gt;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4655967335608256496?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4655967335608256496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4655967335608256496&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4655967335608256496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4655967335608256496'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/sql-server-getting-date-difference-in.html' title='Sql Server getting date difference in hours,min,sec'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1152775264120509331.post-4600139376972567118</id><published>2008-09-04T05:20:00.000-07:00</published><updated>2009-11-15T02:01:50.335-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.net'/><title type='text'>ASP.NET Site Search</title><content type='html'>using System; &lt;br /&gt;using System.Data; &lt;br /&gt;using System.Configuration; &lt;br /&gt;using System.Web; &lt;br /&gt;using System.Web.Security; &lt;br /&gt;using System.Web.UI; &lt;br /&gt;using System.Web.UI.WebControls; &lt;br /&gt;using System.Web.UI.WebControls.WebParts; &lt;br /&gt;using System.Web.UI.HtmlControls; &lt;br /&gt;using System.Data.SqlClient; &lt;br /&gt;using System.Data.OleDb; &lt;br /&gt;using System.Text; &lt;br /&gt;using System.IO; &lt;br /&gt;using System.Text.RegularExpressions; &lt;br /&gt;//Programmed by Renju.R &lt;br /&gt;//Refer Microsoft Indexing Service &lt;br /&gt;public partial class _Default : System.Web.UI.Page &lt;br /&gt;{ &lt;br /&gt;public static DataView tempds = new DataView(); &lt;br /&gt;public static int resultCount = 0; &lt;br /&gt;public DataRow drIndexed; &lt;br /&gt;public DataTable dtPub = new DataTable(); &lt;br /&gt;public DataSet dsPub = new DataSet(); &lt;br /&gt;public DataRow dr2; &lt;br /&gt;public DataTable dt2 = new DataTable(); &lt;br /&gt;public DataSet ds2 = new DataSet(); &lt;br /&gt;public DataSet ds = new DataSet(); &lt;br /&gt;public DataRow dr; &lt;br /&gt;public DataTable dt = new DataTable(); &lt;br /&gt;public static StringBuilder stb = new StringBuilder(); &lt;br /&gt;// public static OleDbConnection oldbCon = new OleDbConnection("Provider=MSIDXS.1;Integrated Security .='';Data Source=Reader"); &lt;br /&gt;public static OleDbConnection oldbCon = new OleDbConnection("Provider=MSIDXS.1;"); &lt;br /&gt;public int count; &lt;br /&gt;protected void Page_Load(object sender, EventArgs e) &lt;br /&gt;{ &lt;br /&gt;} &lt;br /&gt;public void FillResult() &lt;br /&gt;{ &lt;br /&gt;//ds.Merge(dtTemp, false, MissingSchemaAction.Add); &lt;br /&gt;//ds.Merge(ds2.Tables[0]); &lt;br /&gt;//ds.Tables[0].Merge(ds2.Tables[0]); &lt;br /&gt;//tempds = ds.Tables[0].Copy().DefaultView; &lt;br /&gt;MergeSearch(); &lt;br /&gt;Searchfill(); &lt;br /&gt;} &lt;br /&gt;protected void Button1_Click(object sender, EventArgs e) &lt;br /&gt;{ &lt;br /&gt;string searchText = TextBox1.Text.ToString(); &lt;br /&gt;//OleDbCommand cmd = new OleDbCommand("select doctitle, filename, Path ,Attrib, rank, characterization from scope() where FREETEXT('" + searchText + "') and filename &lt;&gt; 'Default.aspx' order by rank desc", oldbCon); &lt;br /&gt;OleDbCommand cmd = new OleDbCommand("select doctitle, filename, Path ,Attrib, rank, characterization from saravanan.Reader..scope() where FREETEXT('" + searchText + "') and filename &lt;&gt; 'Default.aspx' order by rank desc", oldbCon); &lt;br /&gt;cmd.CommandType = CommandType.Text; &lt;br /&gt;if (oldbCon.State == ConnectionState.Closed) &lt;br /&gt;{ &lt;br /&gt;oldbCon.Open(); &lt;br /&gt;} &lt;br /&gt;OleDbDataAdapter da = new OleDbDataAdapter(cmd); &lt;br /&gt;da.Fill(ds); &lt;br /&gt;resultCount = ds.Tables[0].Rows.Count; &lt;br /&gt;ds2.Tables.Add(dt2); &lt;br /&gt;dt2.Columns.Add("new"); &lt;br /&gt;///// &lt;br /&gt;//ds.Tables.Add(dt); &lt;br /&gt;//dt.Columns.Add("search"); &lt;br /&gt;//// &lt;br /&gt;dsPub.Tables.Add(dtPub); &lt;br /&gt;dtPub.Columns.Add("text"); &lt;br /&gt;foreach (DataRow drTemp in ds.Tables[0].Rows) &lt;br /&gt;{ &lt;br /&gt;ReadDocuments((string)drTemp["path"]); &lt;br /&gt;} &lt;br /&gt;FillResult(); &lt;br /&gt;} &lt;br /&gt;void Searchfill() &lt;br /&gt;{ &lt;br /&gt;DataList1.DataSource = ds.Tables[0].DefaultView; &lt;br /&gt;DataList1.DataBind(); &lt;br /&gt;} &lt;br /&gt;public DataSet MergeSearch() &lt;br /&gt;{ &lt;br /&gt;ds.Tables[0].Columns.Add("search"); &lt;br /&gt;int cnt = 0; &lt;br /&gt;// ds.AcceptChanges(); &lt;br /&gt;//int mCount = ds2.Tables[0].Rows.Count; &lt;br /&gt;foreach (DataRow drLoop in ds2.Tables[0].Rows) &lt;br /&gt;{ &lt;br /&gt;DataRow drTest= ds.Tables[0].Rows[cnt]; &lt;br /&gt;drTest["search"] = drLoop["new"]; &lt;br /&gt;//dt.Rows.Add(drTest); &lt;br /&gt;// ds.Tables[0].Rows.Add(drTest); &lt;br /&gt;cnt++; &lt;br /&gt;} &lt;br /&gt;return ds; &lt;br /&gt;} &lt;br /&gt;public DataSet MergedValues(string str) &lt;br /&gt;{ &lt;br /&gt;DataRow dr5 = ds2.Tables[0].NewRow(); &lt;br /&gt;dr5["new"] = (string)str; &lt;br /&gt;dt2.Rows.Add(dr5); &lt;br /&gt;return ds2; &lt;br /&gt;} &lt;br /&gt;public DataSet SearchResult(string text) &lt;br /&gt;{ &lt;br /&gt;DataRow drResult = dsPub.Tables[0].NewRow(); &lt;br /&gt;drResult["text"] = (string)text; &lt;br /&gt;CreateExcerpt((string)text, TextBox1.Text.ToString(),ds); &lt;br /&gt;dtPub.Rows.Add(drResult); &lt;br /&gt;return dsPub; &lt;br /&gt;} &lt;br /&gt;private string parseHtml(string html) &lt;br /&gt;{ &lt;br /&gt;string temp = Regex.Replace(html, "&lt;[^&gt;]*&gt;", ""); &lt;br /&gt;return temp.Replace(" ", " "); &lt;br /&gt;} &lt;br /&gt;public string CreateExcerpt(string source, string keyword,DataSet ds) &lt;br /&gt;{ &lt;br /&gt;count = 0; &lt;br /&gt;string excerpt = string.Empty; &lt;br /&gt;int charsBeforeAndAfter = 100; &lt;br /&gt;int index = source.IndexOf(keyword, StringComparison.CurrentCultureIgnoreCase); &lt;br /&gt;if (index &gt;= 0) &lt;br /&gt;{ &lt;br /&gt;int excerptStartIndex = 0; &lt;br /&gt;int excerptEndIndex = source.Length - 1; &lt;br /&gt;if (index &gt; (charsBeforeAndAfter - 1)) &lt;br /&gt;excerptStartIndex = index - charsBeforeAndAfter; &lt;br /&gt;if ((index + keyword.Length + charsBeforeAndAfter) &lt; (source.Length - 1)) &lt;br /&gt;excerptEndIndex = index + keyword.Length + charsBeforeAndAfter; &lt;br /&gt;excerpt = source.Substring(excerptStartIndex, excerptEndIndex - excerptStartIndex + 1); &lt;br /&gt;index = excerpt.IndexOf(keyword, StringComparison.CurrentCultureIgnoreCase); &lt;br /&gt;excerpt = excerpt.Insert(index + keyword.Length, ""); &lt;br /&gt;excerpt = excerpt.Insert(index, ""); &lt;br /&gt;excerpt = string.Format("...{0}...", excerpt); &lt;br /&gt;foreach (DataRow dr in ds.Tables[0].Rows) &lt;br /&gt;{ &lt;br /&gt;if(count ==0) &lt;br /&gt;MergedValues(excerpt); &lt;br /&gt;count++; &lt;br /&gt;} &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;//stb.Append(excerpt.ToString()); &lt;br /&gt;//stb.Append("&lt;br /&gt;"); &lt;br /&gt;//stb.Append("&lt;br /&gt;"); &lt;br /&gt;return excerpt; &lt;br /&gt;} &lt;br /&gt;public void ReadDocuments(string docPath) &lt;br /&gt;{ &lt;br /&gt;FileStream fs = File.OpenRead(docPath); &lt;br /&gt;string dumptext; &lt;br /&gt;using(StreamReader sr = new StreamReader(docPath, System.Text.Encoding.Default)) &lt;br /&gt;{ &lt;br /&gt;dumptext = parseHtml(sr.ReadToEnd()); &lt;br /&gt;} &lt;br /&gt;SearchResult((string)dumptext); &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;} &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1152775264120509331-4600139376972567118?l=blog.renjucool.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.renjucool.com/feeds/4600139376972567118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1152775264120509331&amp;postID=4600139376972567118&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4600139376972567118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1152775264120509331/posts/default/4600139376972567118'/><link rel='alternate' type='text/html' href='http://blog.renjucool.com/2008/09/aspnet-site-search.html' title='ASP.NET Site Search'/><author><name>Renju</name><uri>http://www.blogger.com/profile/12861145697133158768</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_hLPHcFodaYU/Ssbe03BgVYI/AAAAAAAAAE0/4WSdT_OTIns/S220/DSC01752.JPG'/></author><thr:total>0</thr:total></entry></feed>
