SQL Server Interview Questions

1) What is the difference between CAST and CONVERT in SQL?
Ans)
You can use either CAST or CONVERT. Because CAST and CONVERT provide similar functionality.
The difference is CASE is more ANSI standard and use this only if you are writing a program which you will need to use in many database platforms. Where CONVERT is Microsoft specific and more powerful.
---------------------------------------------------------------------------------
2) Which of the following are the limitations of VIEWS?
Ans)

Select from following answers:
  1. Views cannot be relied on Temporary tables
  2. If TOP or FOR XMl are used then using OrderBy Clause is invalid
  3. We cannot pass parameters to VIEWS
  4. All of the Above

All the above mentioned sentences are the limitations of VIEW.

Sample VIEW example :
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition