|
|
-
|
|
We may sometime need to display the execution plan . I got one such requirement recently and thought of sharing the same here.
I will take two examples into consideration for demonstrating the application . The first with a normal query and then the same with a stored procedure
Case 1: Display......
|
|
-
|
|
lstPlayers.Add(new Players
{
PlayerId = i
,
......
|
|
-
|
|
In earlier version of Sql Server till Sql 11 (code name: Denali) CTP 2, there was no option to check if a conversion from one data type to another was possible or not.Consider the below example where we are trying to convert a varchar to int
Select CONVERT(int,'Just a string')
OR
Select......
|
|
-
|
|
We have encountered this in dot net from framework 2.0. Now we have this in Denali (SQL Server 2012) from CTP 3.
Purpose: It basically identifies if the type specified is applicable for parsing or not and returns the appropriate status.
Syntax: TRY_PARSE ( string_value AS data_type [ USING cultur......
|
|
-
|
|
This function is there in dot net for a long time and now has been added in Sql Server. It formats the value as indicated.
Syntax: Format (expression, format [, culture])
Where,
Expression = > the expression to format
Format => A valid dot net framework format pattern.
Culture => It is opti......
|
|
-
|
|
Purpose: Given a list of values and a position, this function will return the value at the indicated position.
Syntax: Choose ([Position], [Value1],[Value2],…,[ValueN])
Where,
Position => The position number of the value to return. Position number starts from 1
Value1..ValueN => List of values.......
|
|
-
|
|
Well we have this function for a long time. But the log function has been overloaded this time with an additional base argument.
Syntax: Log (Float Expression [, base])
Example
;With CTE AS
(
Select Base = 2
Union All
Select Base+1 from CTE
Where Base
Hope this helps......
|
|
-
|
|
We know that it is impossible to access a temporary table from within a user define function
e.g., the following script will fail
--Checks if the #Temp table exists or not and if so drops it
IF OBJECT_ID('tempdb..#Temp') IS NOT NULL
BEGIN
Drop Table #Temp
END
GO
--Checks if the function......
|
|
-
|
|
Suppose we have some tables in our database out of which some tables have common columns.
Say there are 3 tables (e.g. tbl1, tbl2,tbl3) out of which tbl1 and tbl2 has got a common column between themselves.(Say CommonColumn)
The task is to update the values of all the tables which has got the co......
|
|
-
|
|
We can create our own custom snippet apart from the built in code snippets.
Here we will create a custom snippet to create Sequence objects
Below are the steps to be followed for creating our custom code snippet.
Step 1: Create the snippet file and save it
As an initial step, we need to create ......
|
|