SQL Server interview questions & Answers 6

How do SQL server 2000 and XML linked?

It’s linked in so many ways. To generate the output in xml format to load the XML data into SQL Server tables.

To generate the XML data using select statement can have, "for XML {RAW/AUTO/EXPLICIT)" option added in the last of SQL server >=2000 (not possible in <2000).



example is

use Northwind

select * from orders where orderID in (10248, 10249) for xml auto

Result:

<orders OrderID="10248" CustomerID="VINET" EmployeeID="5" OrderDate="1996-07-04T00:00:00" RequiredDate="1996-08-01T00:00:00" ShippedDate="1996-07-16T00:00:00" ShipVia="3" Freight="32.3800" ShipName="Vins et alcools Chevalier" ShipAddress="59 rue de l&apos;


What is the difference between HAVING clause and the WHERE clause?

Having clause works on record set while Where works on individual record.

 

WHERE is for conditional retrieving but we can’t use Average Functions in WHERE clause. HAVING clause can include AVG Functions.


0 Response to "SQL Server interview questions & Answers 6"

Post a Comment