Saturday, 8 January 2011

Experience Interview 2

How and when to use LIKE statement
Get top two records without Top keyword
set rowcount 2 select column,column1 from tblEmployeeMaster
Difference between Set and Select
Set is a ANSI standard for variable assignment.Select is a Non-ANSI standard when assigning variables.We can assign only one variable at a time.We can assign multiple variable at a time
When assigning from a query that returns more than one value, SET will fail with an error.When assigning from a query that returns more than one value, SELECT will assign the last value returned by the query and hide the fact that the query returned
more than one row.

What is the use of OLAP

OLAP is useful because it provides fast and interactive access to aggregated data and the ability to drill down to detail.
Provide all the built in string function of SQL SERVER
How many objects SQL Server contains
Here is the list of some of the more important database objects ,database, The transaction log, Assemblies, Tables, Reports, File groups, Full-text catalogs, Diagrams, User-defined data types, Views, Roles, Stored procedures, Users, User Defined Functions

Diffrence between varchar and nvarchar
An nvarchar column can store any Unicode data. A varchar column is restricted to an 8-bit codepage. Some people think that varchar should be used because it takes up less space. I believe this is not the correct answer. Codepage incompatabilities are a pain, and Unicode is the cure for codepage problems. With cheap disk and memory nowadays, there is really no reason to waste time mucking around with code pages anymore.
Why we use SET ROWCOUNT in Sql
This syntax is used in SQL Server to stop processing the query after the specified number of rows are returned.
Why we use Unicode In Sql server
Unicode data is stored using the nchar, nvarchar,and ntext data types in SQL Server. Use these data types for columns that store characters from more than one character set. The SQL Server Unicode data types are based on the National Character data types in the SQL-92 standard.
Difference between Triggers and Storedprocedures
Triggers are basically used to implement business rules.Triggers is also similar to stored procedures.The difference is that it can be activated when data is added or edited or deleted from a table in a database.Triggers are special kind of stored procedures that get executed automatically when an INSERT,UPDATE or DELETE operation takes place on a table.
How to get all the parameter of store procedure through query
private void bindParameters( string strName){
SqlConnection conn = new SqlConnection(connectionstring);StringBuilder stbr = new StringBuilder();sb.Append("select,, as [type], t.length ");sb.Append("from syscolumns s ");sb.Append("inner join systypes t ");sb.Append("on s.xtype = t.xtype ");
sb.Append("where id = (select id from sysobjects where name='" + strName + "')"
);SqlDataAdapter adapter = new SqlDataAdapter(stbr.ToString(), conn);
DataTable dt = new DataTable();try{conn.Open();adapter.Fill(dt);DataGrid1.DataSource=dt; //bind parametr with datagrid for visual DataGrid1.DataBind();}catch (Exception ex){
lblException.Text = ex.ToString();}finally{conn.Close();}}

What is SQL tuning
SQL tuning is the process of getting that the SQL statements that an application that will issue that's run in the fastest possible time.
What is SET operator in SQL SERVER
SET operators mainly used to combine same type of data from two or more tables.And another thing is that columns and their data type should be same as all the queries have.The column names from the first query will appear in the result.
UNION - It produce rows of Ist query + rows of 2nd query minus duplicate rows. UNION ALL - It produce rows from both the queries including duplicate rows. MINUS - Rows that are unique for the 1st query will be retrieved
INTERSECT - common rows from both the queries will be retrieved. Join is used to select columns from two or more tables.

Can you define ROLLUP in SQL SERVER 2005
ROLLUP work with the "Group By " clause its main functioning comes into existance when we use Group by. We can get sub-total of row by using the Rollup funtion.When result is return by Group By class first row display the grand total or we can say that the main total. syntax:-select firstcolumn,secondcolumn,sum(thirdcolumn) from tablename group by firstcolumn,secondcolumn with rollup order by firstcolumn.

How many records can take clustured index in sql
A clustered index is a special type of index that reorders the way the records in the table are physically stored . therefore the table can have only one clustered index.
What are Checkpoint in SQL Server

When we done operation on SQL SERVER that is not commited directly to the database.All operation must be logged in to Transaction Log files after that they should be done on to the main database.CheckPoint are the point which alert Sql Server to save all the data to main database if no Check point is there then log files get full we can use Checkpoint command to commit all data in the SQL SERVER.When we stop the SQL Server it will take long time because Checkpoint is also fired

Write a Role of Sql Server 2005 in XML Web Services
SQL Server 2005 create a standard method for getting the database engine using SOAP via HTTP. By this method, we can send SOAP/HTTP requests to SQL Server for executing T-SQL batch statements, stored procedures, extended stored procedures, and scalar-valued user-defined functions may be with or without parameters.

What are the different types of Locks
There are three main types of locks that SQL Server
(1)Shared locks are used for an operation that does not allow to change or update data, such as a SELECT statement.
(2)Update locks are used when SQL Server intends to modify a page, and later promotes the update page lock to an exclusive page lock before actually making the changes.
(3)Exclusive locks are used for the data modification operations, such as UPDATE, INSERT, or DELETE.

What is COMMIT and ROLLBACK statement in SQL
Commit statement helps in termination of the current transaction and do all the changes that occur in transaction persistent and this also commits all the changes to the database.COMMIT we can also use in store procedure. ROLLBACK do the same thing just terminate the currenct transaction but one another thing is that the changes made to database are ROLLBACK to the database.
what is Relational Database
What is the use of DBCC commands
DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks. DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked. and DBCC CHECKALLOC To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE
Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
Can you explain what View is in SQL
View is just a virtual table nothing else which is based or we can say devlop with SQL SELECT query
What is Collate in SQL SERVER2000
The COLLATE clause can be applied only for the char, varchar, text, nchar, nvarchar, and ntext data types.
What is Cursor
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis
Use of Cursor?
What is sub‐query?
Sub‐queries are often referred to as sub‐selects, as they allow a SELECT statement to be executed arbitrarily within the body of another SQL statement. A sub‐query is executed by enclosing it in a set of parentheses. Sub‐queries are generally used to return a single row as an atomic value, though they may be used to compare values against multiple rows with the IN keyword.
What are primary keys and foreign keys?
What is User Defined Functions?
What is Identity?
Which TCP/IP port does SQL Server run on? How can it be changed?

What are the difference between clustered and a non‐clustered index? (Read More Here)
A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
A non clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a non clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

What is SQL Profiler?
What are the authentication modes in SQL Server? How can it be changed?
Windows mode and Mixed Mode ‐ SQL & Windows.
What is Log Shipping?
Log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server. Enterprise Editions only supports log shipping. In log shipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and can be used this as the Disaster Recovery plan. The key feature of log shipping is that it will automatically backup transaction logs throughout the day and automatically restore them on the standby server at defined interval.
What is UNIQUE KEY constraint?
A UNIQUE constraint enforces the uniqueness of the values in a set of columns, so no duplicate values are entered. The unique key constraints are used to enforce entity integrity as the primary key constraints.
What is CHECK Constraint?
A CHECK constraint is used to limit the values that can be placed in a column. The check constraints are used to enforce domain integrity
What is NOT NULL Constraint?
How to get @@ERROR and @@ROWCOUNT at the same time?
If @@Rowcount is checked after Error checking statement then it will have 0 as the value of @@Recordcount as it would have been reset. And if @@Recordcount is checked before the error‐checking statement then @@Error would get reset. To get @@error and @@rowcount at the same time do both in same statement and store them in local variable. SELECT @RC = @@ROWCOUNT, @ER = @@ERROR
What are the advantages of using Stored Procedures?
Can SQL Servers linked to other servers like Oracle?
SQL Server can be linked to any server provided it has OLE‐DB provider from Microsoft to allow a link. E.g. Oracle has an OLE‐DB provider for oracle that Microsoft provides to add it as linked server to SQL Server group
What is PIVOT ?
A Pivot Table can automatically sort,count,and total the data stored in one table or
spreadsheet and create a second table displaying the summarized data. The PIVOT operator turns the values of a specified column into column names, effectively rotating a table.

1. What’s relationship between JavaScript and ECMAScript? - ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.
2. What are JavaScript types? - Number, String, Boolean, Function, Object, Null, Undefined.
3. How do you convert numbers between different bases in JavaScript? - Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);
4. What does isNaN function do? - Return true if the argument is not a number.
5. What is negative infinity? - It’s a number in JavaScript, derived by dividing negative number by zero.
6. What boolean operators does JavaScript support? - &&, || and !
7. What does "1"+2+4 evaluate to? - Since 1 is a string, everything is a string, so the result is 124.
8. How about 2+5+"8"? - Since 2 and 5 are integers, this is number arithmetic, since 8 is a string, it’s concatenation, so 78 is the result.
9. What looping structures are there in JavaScript? - for, while, do-while loops, but no foreach.
10. How do you create a new object in JavaScript? - var obj = new Object(); or var obj = {};
11. How do you assign object properties? - obj["age"] = 17 or obj.age = 17.
12. What’s a way to append a value to an array? - arr[arr.length] = value;
13. What is this keyword? - It refers to the current object.
What is the difference between an alert box and a confirmation box?

What is a prompt box?

How to use "join()" to create a string from an array using JavaScript?

What's Prototypes for JavaScript?

How to create arrays in JavaScript?

How to shift and unshift using JavaScript?

How do you submit a form using Javascript?

What are the problems associated with using JavaScript, and are there JavaScript techniques that you discourage?

How to redirect a page using JavaScript
Latest Answer: window.location="filename" ...

Implement Timer Control
How to implement timer control in JavaScript
Latest Answer: set Timedout("alert('5 seconds')",5000);will display display alert box after 5 seconds ...
How do you get field value in javascript?
Latest Answer: You can use either 1. document.getElementById("").valueor2. document.forms[0]..value
How do you check validations in javascript?
How do you restrict user not to copy web page in Java Script ?
Latest Answer: By disabling right click we can restrict user not to copy webpage sourcecode.
Script to check every character
How will you insert data into db2 using JavaScript?
What is the main difference between Client side JavaScript and and Server side Java Script. How actually
How to add a combo box dynamically at run time in Java script?
How to create an Object in JavaScript ?
Posted by: Puneet20884 | Show/Hide Answer
1) var obj = new Object();
2) var ob = {};
Write a way by which you can do something on the close of the window ?

call onUnload on the body tag and write your javascript code there
Is it possible make a call to server side event of any button using javascript?

Yes, it's possible. You can use __doPostBack() function to call server side event.
Can Javascript code be broken in different lines?
Breaking is possible within a string statement by using a backslash "\" at the end .
document.write("Good Morning. \
I am Mr. John");

But it is not possible within any other javascript statement.
Ex :
is possible but not
document.write \
("Good Morning. I am Mr. John");
What is undefined value means in JavaScript?
There can be multiple reasons of having undefined values
1. Object does not exist. Like you create an object of a control which does not exists in your page and when you access it, it is undefined.
2. No value is assigned to the object.
3. If you are trying to access a property which does not exists for the object

What is the result of below given line of code in Java Script? 5+4+'7'
The answer is 97.

As 5 and 4 are integer so total becomes 9 and it's add '7' to it as string so it becomes 97.
Which method is used to Clear an array using JavaSctipt?
Which method is used to convert a string to uppercase letters?
Name the DataTypes of JavaScript?





Which of the following is not considered a JavaScript keyword?
How to get value from RadioButtonList control?
Here id is the name property of the RadioButtonList

function GetRadioButtonValue(id)


var radio = document.getElementsByName(id);

for (var ii = 0; ii < radio.length; ii++)


if (radio[ii].checked)




How to get value from dropdown (select) control?
Write following code

How to get CheckBox status whether it is checked or not?
Write following code


if it will be checked you will get true else false.

No comments:

Post a Comment