Fine Duplicate rows & Delete duplicate rows

Fine duplicate row SELECT ColumnName, COUNT(ColumnName) AS ColumnName FROM tbl_Employee_M GROUP BY ColumnName HAVING ( COUNT(ColumnName) > 1 ) Delete duplicate rows WITH DUPLICATE(ROW,GROUPROW,ID,FNAME,LNAME) AS ( SELECT ROW,GROUPROW= CASE WHEN ID=ID THEN (SELECT COUNT(*) FROM (SELECT ROW_NUMBER() OVER (ORDER BY ID) AS ROW, ID,LNAME,FNAME FROM MYTABLE ) AS A WHERE A.ID=B.ID AND A.ROW<B.ROW)+1 END,ID,FNAME,LNAME FROM …

Pivot in SQL Server

Declare @table1 table ( SalesPerson varchar(50), Product varchar(50), SalesAmount float ) insert into @table1(SalesPerson,Product, SalesAmount) values (‘Bob’, ‘Pickles’, 100) insert into @table1(SalesPerson,Product, SalesAmount) values (‘Sue’, ‘Oranges’, 50) insert into @table1(SalesPerson,Product, SalesAmount) values (‘Bob’, ‘Pickles’, 25) insert into @table1(SalesPerson,Product, SalesAmount) values (‘Bob’, ‘Oranges’, 300) insert into @table1(SalesPerson,Product, SalesAmount) values (‘Sue’, ‘Oranges’, 500) select * from @table1 …

Crystal report XML file as DataSource

Namespace: using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Web; Global variable: CrystalDecisions.Web.Report rpt = new CrystalDecisions.Web.Report(); CrystalDecisions.CrystalReports.Engine.ReportDocument rpt1; Onbutton or Page Load or any event rpt.FileName = Server.MapPath(“EventHistory.rpt”); crdata.Report = rpt; rpt1 = crdata.ReportDocument; crp.ReportSource = rpt1; crp.RefreshReport(); crp.DataBind();

Client System TimeZone Offset

The getTimezoneOffset method returns an integer value representing the number of minutes between the time on the current machine and UTC. These values are appropriate to the computer the script is executed on. If it is called from a server script, the return value is appropriate to the server. If it is called from a …

Convert DateTime into Specific TimeZone wise with DayLightSavingTime Changes

DateTime date1 = Convert.ToDateTime(“15-03-2010 3:30:00 AM”); //start day of daylighttime //DateTime date1 = Convert.ToDateTime(“07-11-2010 3:30:00 AM”); //DateTime date1 = Convert.ToDateTime(“08-11-2010 3:30:00 AM”); // end day of daylighttime //set local timezone TimeZoneInfo sourceTimeZone = TimeZoneInfo.Local; //get system timezones list System.Collections.ObjectModel.ReadOnlyCollection timeZone = TimeZoneInfo.GetSystemTimeZones(); List tz = timeZone.ToList(); //get event time zone standard name epp2ClientPL.EventConfigurationProperties result = …

Datatable.Copy() & DataTable.Clone() ???

DataTable dtCopy = table.Copy(); it will create “dtCopy” datatable with the records from “table”, DataTable dtClone = table.Clone(); it will create “dtClone” datatable without any records. it only copy structure of “table” datatable. DataTable dtCopy = dataViewTable.ToTable().copy(); it will create “dtCopy” datatablw with records only contains in DataView.