/* ------------------------ My Meta Content Here SEO ------------------------ */

Pages

Main Menu

Wednesday, July 24, 2013

Partial Classes in C#

Partial classes is a new feature of OOPs in .NET2.0  Partial classes means split the class into multiple files. When compiled all the files will be treated as a single class. it may be helpful in large projects,so many people can workon same class. Advantage:  It is especially useful for: Allowing multiple developers to work on a single class at the same time without the need for later merging files in source control. One of the greatest benefits of partial...
Read More »

SQL SERVER - Using sp_msforeachtable in sql server

sp_MSforeachtable can be used to loop through all the tables in your databases. Here are some common usages of this useful stored procedureDisplay the size of all tables in a databaseUSE NORTHWIND EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'" Display Number of Rows in all Tables in a databaseUSE YOURDBNAMEEXEC sp_MSforeachtable 'SELECT ''?'', Count(*) as NumberOfRows FROM ?' Rebuild all indexes of all tables in a databaseUSE YOURDBNAME GOEXEC sp_MSforeachtable @command1="print...
Read More »

SQL SERVER - Important Query Part-2

1. COPYING WHOLE DATA OF A TABLE SELECT * INTO TABLE_DESTINATION FROM TABLE_SOURCE 2. SELECT ONLY DATE PART FROM DATETIME – BEST PRACTICE Just a week ago my Database Team member asked me what is the best way to only select date part from datetime. When ran following command it also provide the time along with date. SELECT GETDATE() ResuleSet : 2007-06-10 7:00:56.107 The required outcome was only 2007/06/10. I asked him to come up with solution by using date functions. The...
Read More »

SQL SERVER - Important Query Part-1

1. Finding last time table was updated SELECT name AS TableName, create_date AS CreatedDate, modify_date as ModifyDate FROM sys.tables order by ModifyDate 2. USING CURSOR IN SQL SERVER -- exec sp_sc_daily_green_leaf_report_mod '2009-11-04',0,'C1','G1' /****** Object:  Stored Procedure dbo.sp_sc_daily_green_leaf_report_mod    Script Date: 11/02/2002 2:15:51 PM ******/ ALTER PROC [dbo].[sp_sc_daily_green_leaf_report_mod] @TODATE VARCHAR(10) , @DIVISION_ID INT=0...
Read More »

My Blog List