hello

Monday, 27 August 2012

row number and rank in sql server

select top 100 RANK() over(order by cust_po_no) as pono, * from dbo.tbl_cust_po_mst



select top 100 Row_number() over(order by cust_po_no) as pono, * from dbo.tbl_cust_po_mst

Thursday, 23 August 2012

MODULEL WISE REPORT STORE PROCEDURE

create proc [dbo].[Issue_Log_App_Pie]
as
begin
declare
@NonSAP numeric(8,2)declare @SAP numeric(8,2)declare @LMDM numeric(8,2)declare @Total numeric(8,2)create table #AppPie(App Varchar(50),Ticket Numeric(8,2))set @NonSAP =(SELECT count(*) as TOTAL_ISSUE from showissuelog where Application_Type_Id=2GROUP BY APPLICATION_TYPE) set @SAP=(SELECT count(*) as TOTAL_ISSUE from showissuelog where Application_Type_Id=1 and Application_id not in (3)GROUP BY APPLICATION_TYPE)set @LMDM=(SELECT count(*) as TOTAL_ISSUE from showissuelog where Application_Type_Id=1 and Application_id in (3)GROUP BY APPLICATION_TYPE)set @Total=(@NonSAP+@SAP+@LMDM)set @NonSAP=(@NonSAP/@Total)*100set @SAP=(@SAP/@Total)*100set @LMDM=(@LMDM/@Total)*100insert into #AppPie values ('Non SAP',@NonSAP)insert into #AppPie values ('SAP',@SAP)insert into #AppPie values ('LMDM',@LMDM)select * from #AppPieend

Monday, 13 August 2012

working with data grid in asp.net c#

<asp:DataGrid ID="DgList" runat="server" AutoGenerateColumns="false" OnItemCommand="DgList_ItemCommand"
OnSelectedIndexChanged="DgList_SelectedIndexChanged"><Columns><asp:BoundColumn DataField="Emp_id" Visible="false"></asp:BoundColumn><asp:BoundColumn DataField="Emp_Name" HeaderText="Emp Name"></asp:BoundColumn><asp:BoundColumn DataField="Dept_Desc" HeaderText="Dept Name"></asp:BoundColumn><asp:BoundColumn DataField="Salary" HeaderText="Salary"></asp:BoundColumn><asp:ButtonColumn CommandName="edit" HeaderText="Edit" Text="Edit"></asp:ButtonColumn><asp:ButtonColumn CommandName="del" HeaderText="Delete" Text="Delete"></asp:ButtonColumn></Columns></asp:DataGrid>
.cs
protected void DgList_SelectedIndexChanged(object sender, EventArgs e){
}

protected void DgList_ItemCommand(object source, DataGridCommandEventArgs e){

string id = e.Item.Cells[0].Text;
if (e.CommandName == "edit"){
Response.Redirect(
"EditEmp.aspx?q=" + id);}

if (e.CommandName == "del"){
Delete(id);
}
}