Create a graph table in SQL Server 2016 - sql-server

I am trying to create a simple node table, using:
CREATE TABLE Person (ID INTEGER PRIMARY KEY, name VARCHAR(100)) AS NODE
But whatever I try I get an error:
Incorrect syntax near the keyword 'as'.
as if it doesn't understand the 'As Node' part.
I am using SQL Server 13.0.1601.
Database compatibility: SQL Server level 2016(130)
SSMS: v17.2
##version: "Microsoft SQL Server 2016 (RTM) - 13.0.1601.5 (X64) Apr 29 2016 23:23:58 Copyright (c) Microsoft Corporation Express Edition (64-bit) on Windows 10 Pro 6.3 (Build 14393: ) (Hypervisor)"

You can't do CREATE TABLE (SQL Graph) in earlier versions of SQL Server, because it applies to SQL Server 2017.
See the documentation.

Related

What is meant by Hostname and Application in SQL Server Profiler

Now I am trying SQL Server Profile. There new trace has been created and filter- TextData like 'select%'. It is running fine with output saved on SQL table.
I got required query. Beside I notice some rows have random alpha-numeric for ApplicationName and HostName(same data are given). Google explains like
what meant by those columns?
why this columns are used?
But my question is:
why random alpha-numeric exist for ApplicationName and HostName?
select distinct top 5 ApplicationName,HostName from UploadDocInsert
order by ApplicationName
ApplicationName HostName
NULL NULL -- Trace start event
00apymnvw4 aipjkkic0q
00db67a5h5 1fztcmcn5i
00doj84va4 st0mjhfqh0
00kob4z7lf i7p379kbdb
Edit 1:
select ##version
Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64)
Sep 24 2019 13:48:23
Copyright (C) 2019 Microsoft Corporation
Express Edition (64-bit) on Linux (Ubuntu 18.04.3 LTS) <X64>
Note: This SQL Server is installed on Linux server.

IF EXISTS shows incorrect syntax near 'IF'. expecting '.' ID, or QUOTED_ID error

I have the following sql query on my local database and it runs with no errors:
DROP TABLE IF EXISTS MadeupTableName
The version of my local database is:
Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Aug 22 2017 17:04:49 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Enterprise 10.0 <X64> (Build 17763: ) (Hypervisor)
If I try to run same SQL on another SQL Server database I get this error in Intellisense:
Incorrect syntax near 'IF'. expecting '.', ID, or QUOTED_ID error
The version information on that database is:
Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64) Jun 17 2016 19:14:09 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
Did something change between 2014 and 2017 or is there some setting that I should check?
Summarizing Sean Lange's response. DROP IF EXISTS was introduced in 2016. For earlier SQL versions this syntax will work:
IF OBJECT_ID('MadeupTableName', 'U') IS NOT NULL DROP TABLE MadeupTableName

SQL2016 Not able to create Column Master Key

I just installed SQL 2016 Standard Edition because I wanted to use the 'Always Encrypted' feature.
However, when I tried to created a Column Master Key under Security->Always Encrypted Keys->Column Master Key, I got the following error:
productversion: 13.0.160.5, productlevel:RTM, edition:Standard Edition 64bit
Any ideas? Thanks!
I was having the same issue. I fixed it by updating to Sql Server 2016 SP1 from Sql Server 2016.
Previously ##version was:
Microsoft SQL Server 2016 (RTM-GDR) (KB3194716) - 13.0.1722.0 (X64) Sep 26 2016 13:17:23 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows 10 Pro 6.3 (Build 14393: )
Now ##version is:
Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64) Oct 28 2016 18:17:30 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows 10 Pro 6.3 (Build 14393: )
Note also that my SSMS is totally up to date.
Tools > Check for Updates > Details - 13.0.16100.1
A coworker has a slightly older build of SSMS and does not even see the option to encrypt columns.
The issue was probably caused by restoring a SQL2014 database. I backed up a 2014 database and then restored it in 2016. SQL may have seen it as a 2014 schema and therefore complained Column Master Key not supported.
How I resolved it: In SSMS 2016, generate .sql script for the imported database (in Advanced settings, choose SQL 2016 script)
Install a new SQL 2016 instance (which may not be necessary will test) and run the .sql generated, rather than the restore option
"Always Encrypted is available in SQL Server 2016 (13.x) and SQL Database. (Prior to SQL Server 2016 (13.x) SP1, Always Encrypted was limited to the Enterprise Edition.)"
Source: https://learn.microsoft.com/en-us/sql/relational-databases/security/encryption/always-encrypted-database-engine?view=sql-server-2017

Can't create column store index on SQL Server 2012

Got this error when trying to create a column store index on a fact table:
Msg 35315, Level 16, State 1, Line 1
CREATE INDEX statement failed because a columnstore index cannot be created in this edition of SQL Server. See Books Online for more details on feature support in different SQL Server editions.
This is from select ##VERSION
Microsoft SQL Server 2012 (SP1) - 11.0.3381.0 (X64)
Aug 23 2013 20:08:13
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
SQL Server Standard edition doesn't support columnstore indexes. From the version comparison for SQL Server 2012, you need Enterprise edition.
Although SQL Server 2012 is specified here, it's worth noting that SQL Server 2016 with Service Pack 1 now allows columnstore indexes to be created across all editions. See here for further details.

SQL Server version

I´m trying to run an SSIS 2013 Package in SQL Server 2014 but i keep getting the error "package migration from version 8 to version 6 failed with error".
So i ckecked the vertion in SQL Server 2014 using a T-SQL query:
SELECT ##VERSION
and i got:
"Microsoft SQL Server 2012 (SP1) - 11.0.3153.0 (X64)
Jul 22 2014 15:26:36
Copyright (c) Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)
"
The response for this query should be SQL Server 2014, right?
What should i do to alter this?
This has nothing to do with running the package. I ran into the same error. What happened was that the package was deployed to an Integration services server (version 2012) using the 2014 IS wizard (or visual studio 2013 SSDT)... SSIS and Visual Studio 2013 will not work for SQL Server 2012. There are several Microsoft connect tickets for this but I doubt any of them will get fixed.
SSIS versions are not backwards compatible.
VS 2013 is used for SQL Server 2014, VS 2010/12 is used for SQL Server 2012.
So the SSIS modules created with VS2013 are only compatible to SQL Server 2014.
Older SQL Server versions (2012, 2008...) can not handle them.

Resources