Daily Archives: August 11, 2017

The SQL Server Case statement is best explained by example. What Case allows us to do is get a variable, or a field from a column in a table or a view and compare it with something else and give us a result based on the comparison. Case starts with […]

SQL Server Case

INTERSECT says “give me what’s common to both” as the word itself implies. It is the intersection of the two. If the first set was the numbers {1, 2, 3, 4} and the second set was the numbers {2, 3, 7, 8} then the intersection would be {2, 3}. Contrast […]

SQL Server Intersect

EXCEPT is available in SQL Server starting with SQL Server 2008. EXCEPT returns distinct rows by comparing the results of two queries. EXCEPT returns distinct rows from the left (first) input query that aren’t output by the right (last) input query. The data and tables are sourced from Philip Burton’s […]

SQL Server Except

Here is a table showing the integer types of SQL Server from the Microsoft website. INT goes up to just over 2 billion. Data type Range Storage bigint -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807) 8 Bytes int -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647) 4 Bytes smallint -2^15 (-32,768) to 2^15-1 (32,767) 2 […]

SQL Server Integer Data Types