Category: SQL Server

SQL SERVER

Introduction to SQL Server Introduction to SQL Server SQL Server is an application software for Relational Database Management System (RDBMS), from Microsoft back in 1988, We can used it for creating, maintaining, managing, and implementing relational databases. It is actually a backend application that allows us to store and process data. It is called the […]

Multiple Active Result Sets (MARS – ADO.NET 2.0)

Multiple Active Result Sets (MARS) is a feature in ADO.NET 2.0. It allows execution of multiple batches against Database on a single connection. Preeviously, only one batch could be executed at a time against a single connection. But, execution of multiple batches with MARS does not mean like simultaneous execution of operations. In previous versions […]

The real difference between SQL Server and Oracle

Visit : https://zonixsoft.com (our Official website) For years now there’s been a constant war between Microsoft supporters and Oracle supporters. Oracle has these features, SQL Server has these features, etc. But that’s not really where the real importance lies. Sure, functionality is a part of it because your database should be able to do what […]

UPDATE Based Off of A Table

visit : https://zonixsoft.com (our official website)  INSERT offers the ability to insert into a table based upon a SELECT statement with the following syntax: INSERT INTO [TABLEA] ([FIELDA],[FIELDB],[FIELDC])         SELECT [FIELDA],[FIELDB],[FIELDC] FROM [TABLEB]   there are time where you may want to do a similar approach with UPDATE. Here is the syntax to do that […]

Passing parameters to dynamic query

visit https://zonixsoft.com (our official Website)   Consider following queries 1. SELECT * FROM @tablename 2. SELECT @colname FROM tbl 3. SELECT * FROM tbl WHERE x IN (@list) 4. SELECT @Cnt=Count(*) FROM tbl WHERE x IN (@list)   For the first query, it will give error ‘Must declare the table variable “@tablename”‘ if @tablename is […]

To get comma separated list of values of single field in SQL Server

Visit: https://zonixsoft.com (our official Website) A solution to get comma separated list of values of single field of a database table   You can use the following code to get the comma separated list of values of a single field of a table:   DECLARE @commaSeparatedVal AS VARCHAR(4000) SELECT @commaSeparatedVal = ISNULL(@commaSeparatedVal +‘,’,”) + CONVERT(VARCHAR,[SKU]) […]

DIFFERENCE and SOUNDEX in Transact-SQL

visit: https://zonixsoft.com (our official Website) DIFFERENCE(string1, string2) Returns the difference between two strings as a value between 0 and 4. This function uses the SOUNDEX algorithm to compare sounds, rather than characters. If the two strings match phonetically very well, the DIFFERENCE() function will return the value 4. If they don’t resemble each other even […]

MERGE Command in SQL Server

visit: https://zonixsoft.com (our official website) In SQL Server 2008, Microsoft introduces the MERGE functionality through the MERGE command. The MERGE command inserts rows that don’t exist and updates the rows that do exist.     What MERGE Command works as,         IF FOUND            THEN UPDATE         ELSE            INSERT;     Until now, this MERGE functionality could […]

CASE (Transact SQL)

Evaluates a list of conditions and returns one of multiple possible result expressions. CASE has two formats: · The simple CASE function compares an expression to a set of simple expressions to determine the result. · The searched CASE function evaluates a set of Boolean expressions to determine the result. Examples: A. Using a SELECT […]