Frequently Asked SQL Server Errors Interview Questions
Q – 1 What will be the program output if it tries to access 11th item in an array of 10 and it is coded with NOSSRANGE?
Ans- in c and c++ there will be a compilation error.if when we declared an array size of 10 and tries to access 11th item.
Q – 2 How to select particular number using rownum?
Example: i need only the second max number using rownum?
Ans- if you know about database then yau can simply solve this problem .and if you don’t know about database then you can’t solve this problem.
Q – 3 In one table there is 10 records without id num, without primary key and it is not sorted then how to extract last 6 record from table?
Ans- CREATE TABLE Sample
(
Col1 varchar(5)
)
insert into Sample values(‘j’)
TABLE:
Col1
j
r
c
r
e
f
g
h
x
j
USING CURSOR: ANSWER
DECLARE @COL1 VARCHAR(5)
DECLARE @COUNT VARCHAR(5)
SET @COUNT=0
DECLARE c1 CURSOR
FOR
SELECT COL1 FROM SAMPLE
OPEN C1
FETCH NEXT FROM C1
INTO @COL1
WHILE @@FETCH_STATUS=0
BEGIN
SET @COUNT=@COUNT+1
IF @COUNT>=5
BEGIN
SELECT @COL1
END
FETCH NEXT FROM C1
INTO @COL1
END
CLOSE C1
DEALLOCATE C1
Q – 4 What is sqlcode -922 & -923?
Ans- Reason why SQLcode -922 generated:
Authorization failed because of the error indicated by error-type
It can be any of the following..
* User authorization.
* Plan access
* connect
* Installation error
* Duplicate exit requested.
Reason code: DB2® reason code associated with authorization failure
Q – 5 What is meant by write off and write on in sap?
Ans- virus means very important resource under seize it is a programm written by some one which makes ur system corrupt
Q – 6 Suppose we are failed to retrieve data from data base. it is an oracle table. Is there a limit on the number of fields that can be a report. My table has 321 fields and I do not have all of them in the report yet?
Ans- If you have 321 field, followed this steps
1)open sql.
2)change dir. if ncecessary.
3)then give command
SQL>desc table_name.
4)check the fields.
5)select or copy that field name.
6)and then use that field in like select empno,empname from
emp.
7) use same script in procedure
8) and show your feilds in your screen.
Q – 7 WHAT IS HTTP 500 Internal Server Error? CAN I SOLVE THIS?
Ans- HTTP means HyperText Transfer Protocol and 500 is internal server error if there is no proper proxy defined if it is required.
Q – 8 How to solve “The SQL Server service failed to start. For more information, see the SQL Server Books Online topics” error?
Ans- Struggled with this one for 2 days and went through tons of forums till I found this one:
http://social.msdn.microsoft.com/Forums/en-
US/sqlsetupandupgrade/thread/84b399b5-7d7b-46fa-8f86-
8c9af2cbf641
SokSa.Icy had the right idea.
My particular problem also involved going through the registry to remove all instances of Visual Studio 2008 as well as a .Net 3.5 hotfix that I could not get rid of.
Once I uninstalled and did everything this guy did, I also went through the registry and searched/deleted all instances of the framework hotfix to get it out of the add / remove dialog box in control panel.
I also used wise registry cleaner to make sure I got all inconsistencies out of the way, rebooted, and installed .net 2.0 Express.
After a successful installation, I rebooted again and ran sql server 2005 express installation and presto – back in business…
Q – 9 Suppose I have table nametemp in that I wanted to add some partial data for a particular column name policyno where data is existing in that column. Ex.Policyno like R-KT-SK-EA-134526 like 100 records. In that 100 records some policynos are just like 134527 I mean with out prefix likeR-KT-SK-EA- now I wanted add this prefix as R-KT-SK-EA-134527 for some 50 records. How can I add partial data?
Ans- UPDATE temp SET = REPLACE(Policyno,’134527′,’R-KT-SK-EA-134527′) WHERE Policyno = ‘134527’
UPDATE temp SET = ‘R-KT-SK-EA’+ Policyno WHERE Policyno = ‘134527’
UPDATE temp SET = ‘R-KT-SK-EA’+ Policyno WHERE policyno not like ‘R-KT-SK-EA-%’
Q – 10 What is tcp?
Ans- The Transmission Control Protocol (TCP) is one of the central protocols of the Internet Protocol Suite. TCP is one of the two original components of the entire Internet Protocol Suite, commonly referred to as TCP/ IP. IP manages the lower-level transmissions from machine to machine and TCP functions at a higher level, concerned only with the two end computers.
TCP (Transmission Control Protocol) is the major transport protocol utilized in IP networks. The TCP protocol exists on the Transport Layer of the OSI Model. The TCP protocol is a connection-oriented protocol which provides end-to-end reliability.
By connection-oriented, we mean that before two network nodes can communicate using TCP, they must first complete a handshaking protocol to create a connection. When we say that TCP provides end-to-end reliability, we mean that TCP includes mechanisms for error detection and error correction between the source and the destination.
These properties of TCP are in contrast to UDP, which is connectionless and unreliable.Higher layer protocols which utilize TCP include HTTP, SMTP, NNTP, FTP, telnet, SSH, and LDAP.