Questions tagged [sql-server-2016]

Use this tag for questions specific to the 2016 version of Microsoft's SQL Server.

Microsoft SQL Server 2016 v.13.0.1601.5 Ready To Manufacture (RTM), was released on June 1, 2016.

There are many editions of SQL Server 2016:

1- Entreprise Edition : Comprehensive, mission-critical in-memory performance with unparalleled security, mission critical high availability, an end-to-end enterprise business intelligence solution with mobile BI built in, in-database advanced analytics at scale, and unlimited virtualization with software assurance. Enterprise edition provides the highest scale and performance for Tier-1 workloads.

2- Standard: Find rich programming capabilities, security innovations, and fast performance for applications and data marts. Easily upgra

3- Developer: Build, test, and demonstrate applications in a non-production environment with this free, full-featured set of SQL Server 2016 SP1 Enterprise edition software.

4- Express: Deploy small databases in production environments with this free, entry-level database that’s ideal for building small, data-driven applications up to 10 GB of disk size.

5- Compact: Free, embedded database app for building ASP.NET websites and Windows desktop applications.

6- Web: Secured, cost effective, and highly scalable data platform for public web sites—available to third-party hosting service providers only.

References

3794 questions
5
votes
4 answers

SQL 2016 - Converting XML to Json

I'm trying to convert a XML column to Json using FOR JSON PATH in SQL2016 but I'm having some issues. Given the following XML (note that some Product elements might have a list of Product inside):
Sibele Lima
  • 206
  • 1
  • 3
  • 15
5
votes
1 answer

Select results from multiple array elements in Json document with Sql Server 2016's OPENJSON function

Is it possible to combine parts of a json document from multiple array elements into a single result in Sql Server 2016? Given this json: { "fruit": { "types": [ { "possible": [ "Apples", "Bananas", "Pears" ], "category":…
Dave Slinn
  • 435
  • 6
  • 13
5
votes
2 answers

SSRS - Display only Top N Category Groups excluding duplicate groups at the end in Bar Chart

Consider the following table I need to generate a bar chart with the Category Group = "Country". The chart should only display the top 3 Groups based on the count of records for a country. I have already applied a filter for the Category Group…
5
votes
6 answers

How do I select the following string so it returns 3? SELECT '1+2'

In a column "SumStrings" of a table I have strings such as '1+2' or '1+2-3' like this: SumStrings 1+2 1+2-3 In other words: DROP TABLE IF EXISTS #theSums; CREATE TABLE #theSums (SumStrings VARCHAR(25)) INSERT INTO #theSums values …
whytheq
  • 34,466
  • 65
  • 172
  • 267
5
votes
2 answers

Aggregate logical AND / OR for columns with type 'bit'

For the T-SQL (SQL Server 2016) bit type, is there some way to achieve an aggregate equivalent of a logical AND and a logical OR? For example, with this table: CREATE TABLE #Example (id int, category int, isRed bit, isBlue bit) INSERT INTO…
Jason C
  • 38,729
  • 14
  • 126
  • 182
5
votes
5 answers

FOR JSON path returns less number of Rows on AZURE SQL

I am using AZURE SQL (SQL Server 2016) and creating a query to give me output in JSON object. I am adding FOR JSON PATH at the end of query. When I execute the procedure without adding FOR JSON PATH to the query, I get 244 rows (no of records in my…
NodeJSNewbi
  • 51
  • 1
  • 4
5
votes
1 answer

SqlGeography spatial operations slow - SQL Server 2016

I have run some tests on the new spatial library SqlGeography in SQL Server 2016, which according to Microsoft should be a lot faster than the previous versions: SQL Server 2016 – It Just Runs Faster: Native Spatial Implementation(s). Apply SQL…
barto90
  • 679
  • 1
  • 9
  • 27
5
votes
1 answer

How to convert AVG() function to decimal in SQL SERVER

Help! I have a table looks like the following one. SELECT * FROM tblshipline WHERE MethodShipped = 'FEDEX' Then I get Qtyshipped 2 3 15 3 10 9 10 Now the question is to calculate the AVERAGE of qtyshipped and round it to 2 decimal number. My…
Stanley
  • 87
  • 1
  • 8
5
votes
4 answers

DENSE_RANK() without duplication

Here's what my data looks like: | col1 | col2 | denserank | whatiwant | |------|------|-----------|-----------| | 1 | 1 | 1 | 1 | | 2 | 1 | 1 | 1 | | 3 | 2 | 2 | 2 | | 4 | 2 | 2…
Mansfield
  • 14,445
  • 18
  • 76
  • 112
5
votes
5 answers

How can I query a table with key/value pairs into a JSON object using FOR JSON PATH?

I have an Asset table and an Attributes table, where the attributes are simple key/value pairs. DECLARE @Asset TABLE(AssetID INT) INSERT @Asset VALUES (1) DECLARE @Att TABLE (AssetID INT, Name NVARCHAR(100), Val NVARCHAR(100)) INSERT @Att VALUES…
Chad Gilbert
  • 36,115
  • 4
  • 89
  • 97
5
votes
1 answer

Sql Server 2016 "The Parameter Is Incorrect" Foreign Key on Database Diagram

I'm running in to a few strange issues when using database diagrams in Sql Server 2016... First, I cannot create relationships by dragging and dropping between columns, both in the same and in different tables. Secondly, when I try to create a…
Brian Corbin
  • 267
  • 1
  • 12
5
votes
6 answers

SSIS Error: Invalid object name - but object exists and query runs in SSMS

I'm currently updating all of our ETLs using Visual Studio 2015 (made in BIDS 2008) and redeploying them to a new reporting server running on SQL Server 2016 (originally 2008R2). While updating one of the ETLs I got this error: Exception from…
Jonathan Porter
  • 1,365
  • 7
  • 34
  • 62
5
votes
2 answers

Bottle neck on SORT operation

I have the following query and it's proving very costly and is taking 6-8 seconds to execute. Looking at the execution plan, the cost is 79% on a SORT operation. Can I get any improvement here? SELECT A.StageName, C.Month, …
Philip
  • 2,460
  • 4
  • 27
  • 52
5
votes
1 answer

Invalid object name when updating after renaming table

Have a very strange problem when trying to rename table and use it. I have a table called oldTable and rename it to the newTable. I can successfully use select on this table using: SELECT * FROM database.dbo.newTable; But when I try to use update…
Grzesiek
  • 442
  • 4
  • 15
5
votes
3 answers

Uninstall SQL Server 2016

I managed to install SSMS 2016 on Windows 7, but it doesn’t work of course. I've tried to uninstall SQL Server 2016 using the SQL 2016 (un)install program in the Control Panel, but when I click remove it throws an error saying that it can't be…