|
|
-
|
|
SQL Server 2012 SSMS has a new node “Sequences” in object explorer under Database-> programmability. This will allows you to create new sequences or update existing sequences by using GUI.
1. Go to Object Expolorer -> Expland database -> Programmabil...
|
|
-
|
|
Often in stored procedures/queries, we will use IF, BEGIN..END, WHILE statements. Now, In SQL Server 2012, SSMS provides an option “Surround with”, which simplifies in enclosing query statements with these blocks.
1. Right Click and choose “Surround w...
|
|
-
|
|
Few users are used to shortcuts in SSMS, where as users coming from Visual Studio background, might be used to certain shortcuts, which might be different from SSMS. Now for the users, who are used to Visual Studio, SQL Server 2012 allows to change the ...
|
|
-
|
|
Often we will copy various parts of a query window content to another query window. While copying we often switch between multiple windows. Now in SQL Server 2012, SSMS supports a new feature "Cycle Clipboard Ring", which allows us to access previously ...
|
|
-
|
|
In previous versions, by using TRY..CATCH block we used to catch the exceptions raised by application and by using RAISEERROR(), error has been thrown back to the called application. However RAISEERROR() has few drawbacks.
1. It will not allow to throw...
|
|
-
|
|
Often in various applications, we need the last date of a month. Previously we used to write various tricks to get this. SQL Server 2012 now provides a function EOMONTH(), which returns the last date of month of given date.
Example:
SELECT EOMONTH...
|
|
-
|
|
`First_Value()` function returns the first value among the set of ordered values according to specified ordered & partitioned criteria.
DECLARE @Salaries TABLE
(
DepartmentId INT,
Salary INT
)
INSERT INTO @Salaries (Dep...
|
|
-
|
|
Parse() function will parse an value into specified datatype. This function relies on CLR. It will take some performance overhead. Use this function only
to convert strings to/from datetime and numeric values.
Example:
SELECT PARSE('Monday, 13 D...
|
|
-
|
|
If the parse operation is successful, this function returns the resultant value; Otherwise, it returns NULL value. This function will rely on CLR. Its advisable to use this function only to convert strings to/from datetime/numbers.
SELECT TRY_PARSE...
|
|
-
|
|
Often in queries, we can see conversion errors like "conversion failed when converting from .... " If we wants to hide these errors and instead of exception, if we want a NULL value, we can use this TRY_CONVERT() function.
If the cast is successful, th...
|
|