Introduction

GROUPING SET were introduced in SQL Server 2008, which allow multiple groupings
to be returned in one record set. In this article I explained the answers for the
questions which raises to everybody’s mind who hear this for the first time.

What is GROUPING SETS?

GROUPING SETS were added in SQL Server 2008 to give you greater flexibility when
defining SELECT statements that include aggregate functions. We can fetch multiple
groups set by executing just one SQL query. Although there are other alternates
to get multiple group sets with one SQL query for example by using ROLLUP and CUBE
clauses. But GROUPING SETS provide more flexibility than other alternates.

GROUPING SETS Equivalents

A GROUP BY clause that uses GROUPING SETS can generate a result set equvalent to
that generated by a UNION ALL of multiple simple GROUP BY clauses. GROUPING SETS
can generate a result equivalent to that generated by a simple GROUP BY, ROLLUP
or CUBE operation. Different combinations of GROUPING SETS, ROLLUP, or CUBE can
generate equivalent result sets.

How to review dynamic HTML content from browser using JavaScript?

These days everybody is using AJAX for web development. Sometimes we need to debug our AJAX code to review what actually get rendered in the browser. The problem is, if you view source code of the page, it will not display Dynamic HTML content.

I have a quick trick to get Dynamic HTML content from a rendered HTML page, directly from the Browser. This is very useful when you need to trace an issue on live website.

JAVASCRIPT: alert(document.body.innerHTML);

All you need to do is to copy the code written above and paste in the URL box of Browser where you website page is opened and press Enter. It will show whole document content(dynamic) in an alert.

To get the Dynamic HTML content on the page itself, use this code:

JAVASCRIPT: document.write(document.body.innerHTML);

You can write your own JavaScript logic and run this way to get result according to your requirement.

Introduction

This article basically illustrates the concept of Data type synonyms which are included in SQL Server 2005 for SQL-92 compatibility.

What are Data Type Synonyms?

Data type synonyms can be used instead of the corresponding base data type name in data definition language (DDL) statements, such as CREATE TABLE, CREATE PROCEDURE, or DECLARE @variable. However, after the object is created, the synonyms have no visibility. When the object is created, the object is assigned the base data type that is associated with the synonym. There is no record that the synonym was specified in the statement that created the object.
All objects that are derived from the original object, such as result set columns or expressions, are assigned the base data type. All subsequent metadata functions performed on the original object and any derived objects will report the base data type, not the synonym. This behavior occurs with metadata operations, such as sp_help and other system stored procedures, the information schema views, or the various data access API metadata operations that report the data types of table or result set columns.

FirstName is actually assigned an varchar(20) data type, and all subsequent metadata functions will report the column as an varchar(20) column. The metadata functions will never report them as a character varying(20) column.
Similarly, LastName is an nvarchar(20) data type column and Makes is a float column.

Conclusion

This is an introduction to the Data Type Synonyms in SQL Server. The idea is to get familiar with another way of writing DDL queries using Data Type Synonyms.