Monday, 25 November 2013

What is the use of sessionstate tag in the web.config file?



What is the use of sessionstate tag in the web.config file?

Configuring session state:
Session state features can be configured via the <sessionState> section in a web.config file. To double the default timeout of 20 minutes, you can add the following to the web.config file of an application:
<sessionState timeout="40"/>

What are the different modes for the sessionstates in the web.config file?


           What are the different modes for the sessionstates in the web.config file?
Off
Indicates that session state is not enabled.
Inproc
Indicates that session state is stored locally.
StateServer
Indicates that session state is stored on a remote server.
SQLServer
Indicates that session state is stored on the SQL Server.

Sunday, 24 November 2013

How to find 6th highest salary



  1. SELECT TOP 1 salary
    FROM (SELECT DISTINCT TOP 6 salary
    FROM employee
    ORDER BY salary DESC) a
    ORDER BY salary

What is Index? It’s purpose?



  1. Indexes in databases are similar to indexes in books. In a database, an index allows the database program to find data in a table without scanning the entire table. An index in a database is a list of values in a table with the storage locations of rows in the table that contain each value. Indexes can be created on either a single column or a combination of columns in a table and are implemented in the form of B-trees. An index contains an entry with one or more columns (the search key) from each row in a table. A B-tree is sorted on the search key, and can be searched efficiently on any leading subset of the search key. For example, an index on columns A, B, C can be searched efficiently on A, on A, B, and A, B, C.

Disadvantage of index?




  1. Every index increases the time in takes to perform INSERTS, UPDATES and DELETES, so the number of indexes should not be very much.

What is sorting and what is the difference between sorting & clustered indexes?




  1. The ORDER BY clause sorts query results by one or more columns up to 8,060 bytes. This will happen by the time when we retrieve data from database. Clustered indexes physically sorting data, while inserting/updating the table.

Difference between char and nvarchar / char and varchar data-type?



  1. char[(n)] - Fixed-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is n bytes. The SQL-92 synonym for char is character.
    nvarchar(n) - Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. The SQL-92 synonyms for nvarchar are national char varying and national character varying.
    varchar[(n)] - Variable-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is the actual length in bytes of the data entered, not n bytes. The data entered can be 0 characters in length. The SQL-92 synonyms for varchar are char varying or character varying.

Popular Posts