SQL Server 2012 is released this weekend. SQL 2012, you can now use select-style statements to return customized results from a single stored procedure.
EXEC uspGetEmployeeManagers 16 WITH RESULT SETS ( ([Reporting Level] int NOT NULL, [ID of Employee] int NOT NULL, [Employee First Name] nvarchar(50) NOT NULL, [Employee Last Name] nvarchar(50) NOT NULL, [Employee ID of Manager] nvarchar(max) NOT NULL, [Manager First Name] nvarchar(50) NOT NULL, [Manager Last Name] nvarchar(50) NOT NULL ) );
Custom paging using an ORDER BY clause
-- Skip 0 rows and return only the first 10 rows from the sorted result set. SELECT DepartmentID, Name, GroupName FROM HumanResources.Department ORDER BY DepartmentID OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY;
Throw to negate the need for custom messages with RAISERROR
C#/VB style Format to format dates, times, numbers
OVER clause for windowed summarization / rolling totals
PARSE to convert strings to dates, currencies, etc
TRY_CONVERT to avoid errors when converting data types
TRY_PARSE to determine if strings = data types
DATEFROMPARTS to take a year, month and day and create a date
CHOOSE to return an index item from a list of selections. (Arrays in SQL?)
No comments:
Post a Comment