Questions tagged [sql-server]

All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag, like sql-server-2016, since it is often relevant to the question.

Microsoft's SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality. It originated from the Sybase SQL Server 4.x codebase and Transact-SQL dialect (T-SQL), but it has forked significantly since then.

SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. The latest released version is SQL Server 2017.

The SQL Server product range is split broadly into six categories:

  1. SQL Server is the main suite of enterprise and developer server products. Primary differences are licensing costs, capacities, and components included in the product, with some minor differences supported language features. Standard components include database language and storage server, developer tools, ETL tools, schedulers, and replication. Other components include OLAP, reporting, and parallel computation. Components runs as NT Services.

  2. SQL Server Express is free for use and distribution but has reduced engine performance, functionality and capacity than found in its other server siblings. It is focused on small deployments and runs as an NT Service.

  3. SQL Server Compact Edition is an embeddable subset of SQL Server. Like the Express edition it has a reduced language, functionality and capacity, but it is free to distribute. It's focused on small installations and desktop applications where its small footprint and no-management-required features are a great advantage.

Note: SQL Server Compact Edition is deprecated. Customers should use SQL Server Express (and possibly LocalDB).

  1. Azure SQL Database is a completely managed, hosted, high-availability SQL Server Database with some language syntax support for federated queries, operated in Microsoft Azure datacenters.

  2. Azure SQL Managed Instance is a completely managed, hosted, high-availability instance of SQL Server with some language syntax support for federated queries, operated in Microsoft Azure datacenters.

  3. SQL Server Analytics Platform System (or APS), formerly known as SQL Server Parallel Data Warehouse (PDW), is a pre-built data warehouse appliance that offers massively parallel processing for SQL Server, allowing support for many hundreds of terabytes.

  4. Azure SQL Data Warehouse is an enterprise-class distributed database in the Azure Cloud capable of processing up to petabyte volumes of relational and non-relational data. It is the industry's first cloud data warehouse with grow, shrink, and pause in seconds.

SQL Server Release History

Version      Year  Release Name               Codename
1.0 (OS/2)   1989  SQL Server 1.0 (16 bit)    Ashton-Tate 
1.1 (OS/2)   1991  SQL Server 1.1 (16 bit)    -
4.21(WinNT)  1993  SQL Server 4.21            SQLNT
6.0          1995  SQL Server 6.0             SQL95
6.5          1996  SQL Server 6.5             Hydra
7.0          1998  SQL Server 7.0             Sphinx
 -           1999  SQL Server 7.0 OLAP Tools  Plato
8.0          2000  SQL Server 2000            Shiloh
8.0          2003  SQL Server 2000 x64        Liberty
9.0          2005  SQL Server 2005            Yukon
10.0         2008  SQL Server 2008            Katmai
10.25        2010  SQL Azure DB               CloudDatabase
10.5         2010  SQL Server 2008 R2         Kilimanjaro (aka KJ)
11.0         2012  SQL Server 2012            Denali
12.0         2014  SQL Server 2014            Hekaton
13.0         2016  SQL Server 2016            SQL16 
14.0         2017  SQL Server 2017            Helsinki 
15.0         2019  SQL Server 2019            Seattle

References

Tagging recommendation:

There are several version- and edition-specific tags. It is recommended to use the tag together with the version- and/or edition-specific tag; for example, or . Do not use this tag for other types of DBMS (, , etc.).

34117 questions
119
votes
4 answers

Why are numbers tables "invaluable"?

Our resident database expert is telling us that numbers tables are invaluable. I don't quite understand why. Here's a numbers table: USE Model GO CREATE TABLE Numbers ( Number INT NOT NULL, CONSTRAINT PK_Numbers PRIMARY KEY…
Jeff Atwood
  • 2,364
  • 2
  • 21
  • 15
94
votes
6 answers

Why would SET ARITHABORT ON dramatically speed up a query?

The query is a single select containing a lot of grouping levels and aggragate operations. With SET ARITHABORT ON is takes less than a second, otherwise it takes several minutes. We have seen this behavior on SQL Server 2000 and 2008.
Jonathan Allen
  • 3,582
  • 7
  • 24
  • 25
63
votes
2 answers

Cast to date is sargable but is it a good idea?

In SQL Server 2008 the date datatype was added. Casting a datetime column to date is sargable and can use an index on the datetime column. select * from T where cast(DateTimeCol as date) = '20130101'; The other option you have is to use a range…
Mikael Eriksson
  • 22,175
  • 5
  • 59
  • 103
62
votes
6 answers

What are different ways to replace ISNULL() in a WHERE clause that uses only literal values?

What this isn't about: This is not a question about catch-all queries that accept user input or use variables. This is strictly about queries where ISNULL() is used in the WHERE clause to replace NULL values with a canary value for comparison to a…
Erik Darling
  • 40,781
  • 14
  • 130
  • 456
54
votes
5 answers

What does the GO statement do in SQL Server?

The GO statement from SQL Server caused me great curiosity and I don't really know how to use it properly. I noticed that queries with or without GO don't return errors and seem to work the same, so what is the purpose of it and why should I use…
53
votes
6 answers

How can I get the actual data size per row in a SQL Server table?

I found this script sql-server-2005-reaching-table-row-size-limit that seems to return the row size per defined data type lengths. I need a script that would give me all the rows in a table that their max data size is over the recommended 8024…
Anthony
  • 633
  • 1
  • 5
  • 5
51
votes
3 answers

How do you grant execute permission for a single stored procedure?

Normally when I create a stored procedure I use the following as a template of sort Create procedure <@param1 , @param2 , etc..> as begin end Is there a way to include granting execute permission on only…
DaneEdw
  • 613
  • 1
  • 5
  • 6
49
votes
2 answers

Is there any difference at all between NUMERIC and DECIMAL?

I know that the NUMERIC and DECIMAL data types in SQL Server work the same: the syntax for creating them is the same, the ranges of values you can store in them is the same, etc. However, the MSDN documentation describes the relationship between the…
KutuluMike
  • 1,589
  • 2
  • 14
  • 13
48
votes
2 answers

Difference between Hash, Merge and Loop join?

In SQL Server you can specify the join hints: HASH JOIN MERGE JOIN LOOP JOIN What is the definition of those three join hints, and when should each be used?
Andrew Bickerton
  • 3,234
  • 5
  • 29
  • 38
43
votes
2 answers

Changing column width

Will increasing a column (nvarchar) width necessarily drop the table? In other words, can the width be changed in a production environment with active users? I figured that if the size is increasing (as opposed to decreasing) this wouldn't be a…
Fernando
  • 433
  • 1
  • 4
  • 4
43
votes
4 answers

SQL Server "Suspect" database?

What do you do when you have a database that is marked as Suspect? Restore from the last backup? Please advise.
db7
  • 1,371
  • 4
  • 16
  • 20
42
votes
3 answers

Difference between SQL batch, statement and RPC?

What is the difference between SQL batch, T-SQL statement and Remote Procedure Call? How can I tell if part of the T-SQL code is a batch or statement?
FrogEye
  • 423
  • 1
  • 4
  • 4
40
votes
6 answers

What is the best way to get a random ordering?

I have a query where I want the resulting records to be ordered randomly. It uses a clustered index, so if I do not include an order by it will likely return records in the order of that index. How can I ensure a random row order? I understand that…
goric
  • 1,626
  • 3
  • 18
  • 25
40
votes
6 answers

How to execute SQL against all DBs on a Server

I have some standard SQL that I run against multiple databases on a single server to help me diagnose problems: select so.name, so.type, MAX(case when sc.text like '%remote%' then '' ELSE 'N' END) AS Relevant, @@ServerName as…
Andrew Bickerton
  • 3,234
  • 5
  • 29
  • 38
40
votes
2 answers

What's the point of WHERE 1=2 for SELECT INTO table query

If we want to create a new table from an existing one in SQL Server we can do the following SELECT * into Table2 from Table1 WHERE 1=2 Whats the point of where clause? I tried it without the where clause and it ran fine. I've seen this where clause…
Muhammad Hasan Khan
  • 683
  • 2
  • 6
  • 11
1
2 3
99 100