MS SQL Interview Questions and Answers
Question - 11 : - What is the recommended way to send mail from SQLAgent in SQL Server 2005?
Answer - 11 : - Database Mail
You can use either Database Mail or SQLMail with SQL Agent in SQL Server 2005. However since SQLMail will be removed, it is recommended that you use Database Mail.
Question - 12 : - When you create a new Message Type in the SQL Server 2005 Service Broker, what does the Authorization parameter signify?
Answer - 12 : - The owner of the message type.
This parameter determines the owner of the message type. This defaults to the current user.
Question - 13 : - What the heck does ATN2 do?
Answer - 13 : - The angle between the x-axis and a ray.
This is a mathematical function that returns the angle between the positive x-axis and the ray that passes through the two coordinates passed in. The angle is in radians.
Question - 14 : - How does a differential backup know which extents have changed so that it can be very quickly run?
Answer - 14 : - The DCM tracks changes. The differential backup reads the extents from this structure.
A differential backup uses the Differential Change Map to determine which extents have changed and need to be include in the backup. This greatly speeds the differential backup process.
Question - 15 : - If you run this, what does it return?
select applock_mode('public', 'SalesApp', 'Transaction')
Answer - 15 : -
The type of lock being held by an application that requested it.
This command returns the lock mode held by an application that was requested with the sp_getapplock procedure.
insert mytable select ''
insert mytable select ' '
select * from mytable where mychar = ''
select * from mytable where mychar = ' '
Question - 16 : - How would you change a column from VARCHAR(10) to VARCHAR(50)?
Answer - 16 : - ALTER TABLE techpreparation_questions CHANGE techpreparation_content techpreparation_CONTENT VARCHAR(50).
Question - 17 : - How would you delete a column?
Answer - 17 : - ALTER TABLE techpreparation_answers DROP answer_user_id.
Question - 18 : - When you create a table, and then run SHOW CREATE TABLE on it, you occasionally get different results than what you typed in. What does MySQL modify in your newly created tables?
Answer - 18 : - 1. VARCHARs with length less than 4 become CHARs
2. CHARs with length more than 3 become VARCHARs.
3. NOT NULL gets added to the columns declared as PRIMARY KEYs
4. Default values such as NULL are specified for each column
Question - 19 : - How do you get a portion of a string?
Answer - 19 : - SELECT SUBSTR(title, 1, 10) from techpreparation_questions;
Question - 20 : - How do you convert a string to UTF-8?
Answer - 20 : - SELECT (techpreparation_question USING utf8);