Archive

Posts Tagged ‘#SQLServer’

What is UniqueIdentifier in SQL Server

In simple words, the UniqueIdentifier is one of the data types that the SQL Server offers to the developers.

The question is What is does and Where we should use it? Yes, that’s very interesting.

The UniqueIdentifier is a data type which can contain a unique hexadecimal value up to 36 characters. More technically, it’s a 16-byte GUID.

We can either define a column or a variable with this data type. A column or local variable of UniqueIdentifier data type can be initialized to a value in the following ways:

  • By using the NEWID or NEWSEQUENTIALID function. It’s recommended you use NEWSEQUENTIALID function. I’m not gonna discuss why? All I can say is NEWSEQUENTIALID is faster than the NEWID due to its internal working.
  • By converting from a string constant in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, in which each x is a hexadecimal digit in the range 0-9 or a-f. For example, 6F9619FF-8B86-D011-B42D-00C04FC964FF is a valid UniqueIdentifier value.

Read more…

SQL Server 2012 Programming Training at Honeywell Technologies, Bangalore, 19 – 21 November, 2015

Completed SQL Server 2012 Programming training at Honeywell Technologies, Bangalore. Large batch but I really enjoyed teaching SQL Server T-SQL Programming stuff to guys. It’s always learning while teaching…Unfortunately couldn’t take a pic of the batch…Next time for sure… 🙂

SSIS Training at Mphasis, Bagmane Tech Park, Bangalore, Jan 2 – Jan 5, 2014

Started new year with SSIS training at Mphasis, Bagmane Tech Park, Bangalore on Jan 2nd. Just done with it. Great learning and sharing during session…Nice participants…

IMAG0798

Visual Studio 2010 Doesn’t Support SQL Server 2008 Business Intelligence Templates

Yes. That’s true. The Visual Studio 2010 doesn’t support the SQL Server 2008 or SQL Server 2008 R2 Business Intelligence templates. If we go to the Visual Studio 2010 new project’s window, what we get is shown below.

MissingBI

So, what’s the solution? If we wish to work on the SQL Server 2008/2008 R2 Business Intelligence projects, we need to have the Visual Studio 2008 or Visual Studio 2008 Shell. The Visual Studio Shell is installed when we install Business Intelligence Development Studio during SQL Server shared components intallation.

The Microsoft has removed the SQL Server 2008/2008 R2 BI support from the Visual Studio 2010. The Visual Studio 2010 has been designed for the SQL Server 2012, which is available in the market now. In addition, the Business Intelligence Development Studio has also been renamed as the SQL Server Data Tools in the SQL Server 2012.

Using RAISERROR in SQL Server

The RAISERROR statement is used to intentionally raise an error in the T-SQL block. It can be used anywhere i.e. outside the TRY…CATCH block or inside the TRY block or inside CATCH block or inside the TRY and the CATCH block as well. 

Generally, we use it to raise a user-defined error in the T-SQL block like inside a Stored Procedure code.

Take a look at below the RAISERROR statement syntax.

Let me explain the parameters/arguments.

Read more…

Using CONTINUE Keywork in SQL Server

It is primarily used with the WHILE loop. It restarts the WHILE loop, ignoring all statements after it.

Take a look at an example below.

 

While Loop in SQL Server

The “WHILE” (Transact-SQL) is a loop structure in the SQL Server. It loops as long as condition for is met, else comes out of loop and executes the next statement after the END keyword, if any.

We can control the execution of WHILE using BREAK and CONTINUE statements. I’ll be discussing the BREAK and CONTINUE statements in another blog…Keep an eye on my blog…

Here goes the syntax for the WHILE statement:

 

Here goes an example of using the WHILE statement: