Tuesday, August 30, 2011

About Views

Which of the following statements is correct?

Ans1: CREATE VIEW dbo.vEmpSalTotal AS SELECT EmpId, SUM(EmpSal) FROM [Emp] GROUP BY EmpId
Ans2: CREATE VIEW dbo.vEmpSalTotal AS SELECT EmpId, SUM(EmpSal) as TotalSal FROM [Emp] GROUP BY EmpId
Ans3: The sp_HelpText system stored procedure reveals the code which created an object. For Example below code reveals the View text for the View : "viewGetDetails"

sp_HelpText viewGetDetails.

Ans4: You can Encrypt the view using the "WITH ENCRYPT" keyword in the Create View clause:

ALTER VIEW dbo.viewGetDetailsWITH ENCRYPTION
AS
SELECT
EmpID, SUM(EmpSal) AS TotalSalFROM [Emp]GROUP BY EmpID

No comments:

Post a Comment