Saturday, May 15, 2010

ASP.Net : What is webgardening

Web gardening enables multiple worker processes to run at the same time. However, you should note that all processes will have their own copy of application state, in-process session state, ASP.NET cache, static data, and all that is needed to run applications.

When the Web garden mode is enabled, the ASP.NET ISAPI launches as many worker processes as there are CPUs, each a full clone of the next (and each affinitized with the corresponding CPU). To balance the workload, incoming requests are partitioned among running processes in a round-robin manner. Worker processes get recycled as in the single processor case. Note that ASP.NET inherits any CPU usage restriction from the operating system and doesn’t include any custom semantics for doing this.

SQL Query : Getting Nth highest salary from the employee

In any interview these days , everybody would be facing this question some time in their career. Below is the easy way to get the Nth highest salary among the employee salaries


SELECT TOP 1 SALARY FROM (SELECT DISTINCT TOP N SALARY
FROM EMPLOYEE ORDER BY SALARY DESC)SAL
ORDER BY SALARY


Place the value in place of N.

Saturday, May 1, 2010

SQL Server : INTERSECT

-Returns any distinct values that are returned by both the query on the left and right sides of the INTERSECT operand

-It almost works like INNER JOIN

-Difference is INTERSECT treats two NULL values are same whereas INNER JOIN treats two NULL values are different

SQL Server : Number of nesting levels in stored procedures

Stored procedures are nested when one stored procedure calls another or executes managed code by referencing a CLR routine, type, or aggregate. You can nest stored procedures and managed code references up to 32 levels. The nesting level increases by one when the called stored procedure or managed code reference begins execution and decreases by one when the called stored procedure or managed code reference completes execution. Attempting to exceed the maximum of 32 levels of nesting causes the whole calling chain to fail. The current nesting level for the stored procedures in execution is stored in the Any reference to managed code from a Transact-SQL stored procedure counts as one level against the 32-levelnesting limit. Methods invoked from within managed code do not count against this limit.

When a stored procedure executes managed code by referencing a CLR routine, type, or aggregate, this reference also counts as one level of nesting. Methods invoked from within managed code do not count against this limit. The current nesting level is returned by the @@NESTLEVEL function. When a CLR stored procedure performs data access operations through the Microsoft SQL Server managed provider, an additional nesting level is added in the transition from managed code to SQL and this level is reflected in the @@NESTLEVEL function.

An error in a nested stored procedure is not necessarily fatal to the calling stored procedure. When invoking stored procedures within stored procedures, use the Transact-SQL RETURN statement to return a return code and check the return code from the calling stored procedure. In this way, you can specify the behavior of your stored procedures when errors occur. For more information about using return codes, see Returning Data Using a Return Code.

Stored procedures can even do a nested call to themselves, a technique known as recursion.Although the nesting limit is 32 levels, SQL Server has no limit on the number of stored procedures that can be invoked from a given stored procedure, provided that the subordinate stored procedures do not invoke other
subordinate stored procedures and the maximum nesting level is never exceeded.

Sunday, April 25, 2010

fundamental questions

One of my friend had been to one interview in last weekend and the questions he had faced are below.I see that all the questions were asked looks like we use them in our daily programming .But when look at the them first time,It is giving me strange feeling because the technical names of that concepts I have not known.

What is cross page posting in ASP.Net...?

Cross-page posting is desired in a scenario where data is collected on one Web page and processed on another Web page. ASP.NET  2.0 introduces a new property in the Page class called ‘PreviousPage’ which gets the page that posted to the current
page .

ASP.NET by default, submits the form to the same page. Cross page posting is submitting the form to a different page. This is usually required when you are creating a multi page form to collect information from the user on each page. When moving from the source to the target page, the values of controls in the source page can be accessed in the target page.

What is SCOPE_IDENTITY() :-

This function can return the last identity value inserted into an identity column in the same scope e.g. a stored procedure, trigger, function, or batch. .
Here is the example that will tell how to use scope_identity() function

CREATE PROCEDURE Employee(
@EmpName VARCHAR(50),
@EmpEmail VARCHAR(50),
@PhoneNo VARCHAR(50),
@EmpID INT OUTPUT)
AS
BEGIN
INSERT INTO Employee (EmpName, EmpEmail , PhoneNo)
VALUES (@EmpName,@EmpEmail,@PhoneNo)
 
SET @EmpID = CAST(SCOPE_IDENTITY() AS INT)
EN
 
 
What is current Identity : 

Returns the last identity value generated for a specified table or view.
The last identity value generated can be for any session and any scope.

USE AdventureWorks;
GO
SELECT IDENT_CURRENT ('Person.Address') AS Current_Identity;
GO 

Wednesday, April 21, 2010

Biztalk components : BAM Portal

Business end users use the BAM portal to monitor Key Performance Indicators (KPIs), which measure progress toward a business goal, as well as other information about their business process. Business analysts use the BAM portal to oversee the creation of observation models, which are high-level definitions of the visibility requirements within the business process. Administrators use it for a variety of monitoring activities, including monitoring the health of the business process management system.

What is the BAM portal?

The BAM portal in BizTalk Server 2006 provides real-time, end-to-end visibility into a business process. It is a Web-based feature that consists of a collection of ASP.NET 2.0 pages. You can customize BAM to enhance the performance and experience for your users. 

Why use the BAM portal?

The BAM portal allows you to perform searches, aggregate data, and set alerts on a BAM view, which is a perspective on your business data. This visibility can provide the necessary KPI information for your business, or it can be used as proof of concept before you implement another solution such as extending a Microsoft Office Excel 2003 spreadsheet, using SQL Reporting, or building a custom user interface (UI).
BAM portal components

Following is a brief description of the BAM portal components. For a more detailed description, see the topics in See Also.

Activity searches

You use the BAM portal to perform searches against BAM data to find a specific BAM activity. You create queries by adding and removing search clauses that allow you to display those activities that match criteria for which you want to be alerted.
Queries can be saved and reused. They can also be the basis for an alert, such as a notification when a purchase order arrives from a specific customer.

Aggregations

The portal allows you to capture a snapshot of data and display it in the form of a graphical chart and accompanying PivotTable chart. This data gives you visibility into the health of that process or the overall business. For example, a user may wish to see a simple pie chart that shows a breakdown of the 1,000 invoices received in a day in terms of what stage of processing has been reached by each invoice (400 still in "evaluation," 400 rejected, 100 paid, and 100 still in "fund allocation").
The data presented can be the basis for creating an alert, such as "Notify me if there are ever more than 500 invoices in the 'evaluation' stage of the process."

Alert Manager

The portal provides a user interface for the creation of alerts and the editing of existing alerts. Alerts take the conditions that are to be monitored from either the Activity Search or Aggregations page. The Alert Manager is where you fill in the relevant parts of an alert, such as who to notify, how (for example, through e-mail), and whether others can see and subscribe to the alert.