Sql Server Interview Questions and Answers (1758) - Page 68

Tell us about difference between STUFF and REPLACE function in Sql Server?

REPLACE function is used to replace all the occurrences of the given pattern in a string.

Example:
select Replace('vishal','l','n');

Output is nishal

STUFF function is used to replace the part of string with some other string.

Syntax:
Stuff(expression,start_pos,length,replacementcharacters);


Example:
Select Stuff('vishal',1,2,'ku');

Output is kushal
What do we mean by Sql Server Browser?

Sql Server Browser performs following actions:-

1. Browsing a list of available servers.
2. connecting to correct server instance.
3. Connecting to dedicated administrator connection(DAC).
Which statement is the correct statement for creating Views?

NOTE: This is objective type question, Please click question title for correct answer.
Which statement is False about Sql Profiler?

NOTE: This is objective type question, Please click question title for correct answer.
Differentiate between a Local and a Global temporary table?

1). A Local temporary table exists only for the duration of a connection or,if defined inside a compound statement,for the duration of the compound statement.

2). Global temporary tables created with a double "##" are visible to all sessions.

3). Global temporary tables are dropped when the session that created it ends,and all other sessions have stopped referencing it.
Which statement is used when we do not want our data to be Rolledback?

NOTE: This is objective type question, Please click question title for correct answer.
What is the symbol for Local Temporary table?

NOTE: This is objective type question, Please click question title for correct answer.
What is the symbol for Global Temporary table?

NOTE: This is objective type question, Please click question title for correct answer.
What is the symbol for Table variable?

NOTE: This is objective type question, Please click question title for correct answer.
Where do Local or Global tables store?

NOTE: This is objective type question, Please click question title for correct answer.
Which statements are true concerning Local Temporary Tables?

NOTE: This is objective type question, Please click question title for correct answer.
Which statements are correct concerning Global Temporary Tables?

NOTE: This is objective type question, Please click question title for correct answer.
Which statements are correct concerning Table Variables?

NOTE: This is objective type question, Please click question title for correct answer.
Create,Alter command falls into which category?

NOTE: This is objective type question, Please click question title for correct answer.
How to find the active SQL connections?

By Writing below code,we can find active SQL connections:-

SELECT db_name(dbid) as DatabaseName,count(dbid) as NoOfConnections,

loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid,loginame;

How to remove indexes from Tables?

Syntax to Remove an Index on Column:-
DROP INDEX tablename.indexname

Example:
DROP INDEX Employee.Ic_pan_number

How to check whether local temp tables exist or not?

We have to write tempdb.. followed by Table name in object_id as:-
if(object_id('tempdb..#Employee') is not null)

Print 'Present';

What's Difference between checking permanent and temporary tables?

We have to write below query:-

//temporary table
if(object_id('tempdb..#Employee') is not null)

drop table #Employee;


//permanent table
if(object_id('Employee1') is not null)

drop table Employee1;

Which Sql Server function is used for getting character position?

NOTE: This is objective type question, Please click question title for correct answer.
What do we mean by CHARINDEX function in Sql Server?

CHARINDEX is an in-built Sql Server function that accepts two arguments.The first argument is the character which are being searched for and the second parameter is the original string expression.It will return the first index position that the character passed into the first argument which is present inside the string expression.

Syntax:-
CHARINDEX (string_char_to_find,string_char);

For Ex:-
SELECT CHARINDEX(' ','Hello World');

Here,
H = 1,
e = 2,
l = 3,
l = 4 and so on.

Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories