1. What is the output of select count(0) ?
2. Quess output of the below query ?
DECLARE @ssn varchar(8)
SELECT @ssn as ssn
3. Write a query to combine student names from below table ?
Ans. select StdName+',' from StudentTable for XML Path ('')
4. Write a query to find in how many objects StudentTable is referrred ?
SELECT *FROM SYS.SYSCOMMENTS SC
INNER JOIN SYS.SYSOBJECTS SO ON SC.ID = SO.ID
AND SC.TEXT LIKE '%StudentTable%'
5. What is the output of below query ?
Ans. Throws error. Must have equal number of columns in target list.
6. What is the output of below queries ?
1. select 1
2. select 1
First Query : Since union returns only distinct values
Second Query : Union all returns duplicates as well.
7. What is the output of below query ?
8. What is the outcome of below query ?
select 0 + count(0)