• Asp.Net
  • MVC
  • C#
  • SQL Server
  • JavaScript
  • Learn from Life

Prakash Rathod

~ Passion is not a logic; it's an emotion.

Prakash Rathod

Monthly Archives: August 2010

Fine Duplicate rows & Delete duplicate rows

23 Monday Aug 2010

Posted by Prakash in SQL Server, Uncategorized

≈ Comments Off on 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 (SELECT ROW_NUMBER() OVER (ORDER
BY ID) AS ROW,
ID,LNAME,FNAME FROM MYTABLE
)AS B
)
DELETE FROM DUPLICATE WHERE GROUPROW1

Pivot in SQL Server

13 Friday Aug 2010

Posted by Prakash in SQL Server, Uncategorized

≈ Comments Off on 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

SELECT SalesPerson, [Oranges] AS Oranges, [Pickles] AS Pickles
FROM
(SELECT SalesPerson, Product, SalesAmount
FROM @table1 ) ps
PIVOT
(
SUM (SalesAmount)
FOR Product IN
( [Oranges], [Pickles])
) AS pvt

Crystal report XML file as DataSource

13 Friday Aug 2010

Posted by Prakash in Crystal Report, Uncategorized

≈ Comments Off on 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

08 Sunday Aug 2010

Posted by Prakash in Asp.Net, Uncategorized

≈ Comments Off on 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 client script, the return value is appropriate to the client.

This number will be positive if you are behind UTC (e.g., Pacific Daylight Time), and negative if you are ahead of UTC (e.g., Japan).

For example, suppose a server in New York City is contacted by a client in Los Angeles on December 1. getTimezoneOffset returns 480 if executed on the client, or 300 if executed on the server.

function TZDemo()
{
var d = new Date();
var minutes = d.getTimezoneOffset();

var s = “”;
s += “The current local time is “;
s += minutes / 60;
if (minutes < 0)
s += " hours after UTC";
else
s += " hours before UTC";

return(s);
}

Recent Posts

  • Create a custom autocomplete control in ASP.NET MVC
  • Nth Highest Salary
  • Generate x509 certificate in pem, cer and pfx and export public key
  • Send an image (stored as base64 string) inline in email
  • Put/Delete http verb not working server

Categories

  • Android
  • Asp.Net
  • BANKING
  • c#.net
  • Crystal Report
  • HTML5 CSS3
  • iPhone
  • JavaScript
  • Life – Spiritual – Reality
  • Lightswitch
  • Links
  • MAC
  • MVC
  • Netoworking
  • Silverlight
  • SQL Interview Questions
  • SQL Server
  • Uncategorized
  • Version Controls
  • Windows Store

Archives

  • August 2019
  • May 2019
  • April 2018
  • October 2017
  • August 2017
  • April 2017
  • March 2017
  • February 2017
  • December 2016
  • April 2016
  • January 2016
  • November 2015
  • January 2015
  • December 2014
  • October 2014
  • September 2014
  • June 2014
  • April 2014
  • March 2014
  • February 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • July 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • July 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009

© 2021 Prakash Rathod