I have a script like this
CREATE TABLE [dbo].[MYTABLE]
(
....
CONSTRAINT [PK_MYTABLE]
PRIMARY KEY CLUSTERED ([Legend_Id] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
On SQL Server 2017, it does not run (OPTIMIZE_FOR_SEQUENTIAL_KEY is not a recognized CREATE TABLE option)
On SQL Server 2019 (with the database in SQL Server 2017 compatibility mode), it runs successfully.
We are using SQL Server 2019 to validate something that will be executed on SQL Server 2017. I think this is weird and I was expecting a failure also in the SQL Server 2019 version.
Is there a way to force SQL Server 2019 to strictly behave as SQL Server 2017?
This might be useful to you - your script looks to be that which would be generated by SSMS.
In the options, if you go to SQL Server Object Explorer > Scripting there is a Version Options section:
Is there a way to force SQL Server 2019 to strictly behave as SQL Server 2017?
Compatibility mode is there to facilitate upgrades by preventing breaking changes and optimizer enhancements when running a workload tested on an older version and running on a newer version.
But just because your application is running in compatibility mode doesn't mean you can't start using new features introduced in SQL Server 2019. Some changes may be blocked to protect backwards-compatibility, but most will be available to use if you want.
Related
We are on - Microsoft SQL Server 2019 (RTM-CU9) (KB5000642) - 15.0.4102.2 (X64) Jan 25 2021 20:16:12 Copyright (C) 2019 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)
Configured Always Encryption successfully on the DB server. As part of testing, we removed the cert from the windows cert store and ran the select query with the "Column Encryption Setting=enabled" setting, the query is throwing an error in the message as expected but the query keeps running until I kill it. This is happening in the DB server and from other servers too. Has anyone seen this issue before? Thanks in Advance!
This was happening because we had symmetric Key Column level Encryption on the same table. We had multiple Symmetric keys, certs from previous testing. Once we removed all of those, the above issue disappeared. I am not sure what the old Symmetric keys had to do with the above issue as it was on another column on the same table but cleaning them up it resolved it.
Can I create indexes with ONLINE option set to ON using SSDT publish? If I add such definition to the index publish is simply ignoring that setting. SQL Server 2017 Enterprise
Annoyingly SSDT ignores this property.
If you are on a version of SQL Server that supports the ELEVATE_ONLINE database scoped configuration you can use this to ensure that all such operations happen online (SQL Server 2017 Enterprise is not such an edition, currently this is a preview option in Azure only).
Alternatively you can set your deployment pipeline up to run a "pre model" phase that can include custom scripts to create the index if needed with desired options before the SSDT diff is generated.
To achieve this entirely within SSDT you would need to use a deploy contributor. For this option an example project you may well find highly relevant is EditionAwareCreateIndex
In SQL Management Studio for a local database you can pressCTRL+0 to set a cell value to null
With SQL Azure this doesn't work with the following error message:
I submitted a bug here: https://feedback.azure.com/forums/908035-sql-server/suggestions/35683135-add-ctrl-0-back-for-sql-azure-in-smss
As no one is voting this up I have the feeling there is another way to set the value to null, and I'm just using some legacy path no one cares about.
To be clear:
I strongly prefer to not write every time a SQL statement, because there will be a time that I forget to write the where clause before running it, corrupting all my data.
I also don't like to write a CMS everytime I have to set something to null.
Any workarounds for setting an individual cell to null?
For people not believing me:
CREATE TABLE [dbo].[NewsSource](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](120) NOT NULL,
[Thumbnail] [nvarchar](150) NULL,
[RssFormatId] [int] NULL,
[Active] [bit] NOT NULL,
[Interval] [int] NULL,
[LastStarted] [datetime2](7) NOT NULL,
[LastSuccess] [datetime2](7) NOT NULL,
[TopicId] [int] NULL,
CONSTRAINT [PK_NewsSource] PRIMARY KEY CLUSTERED
As for some reason I'm not being believed. To be clear: for me it's very easily reproducable.
Create any table with a nullable column on SQL Azure.
Set the column to any value.
Use SMSS to try to set the value of this column to null through CTRL+0
100% of the times I'm getting the error message attached.
If this is really rare it could mean I have somehow a corrupted SMSS.
Version numbers
Microsoft SQL Azure (RTM) - 12.0.2000.8 May 2 2019 20:11:13 Copyright (C) 2019 Microsoft Corporation
SQL Server Management Studio 15.0.18040.0
Microsoft Analysis Services Client Tools 15.0.900.156
Microsoft Data Access Components (MDAC) 10.0.17763.1
Microsoft MSXML 3.0 6.0
Microsoft Internet Explorer 9.11.17763.0
Microsoft .NET Framework 4.0.30319.42000
Operating System 6.3.17763
To show that the normal manual Update statement succeeds:
UPDATE NewsSource
SET Thumbnail = null
WHERE Id = 17
UPDATE
As some people mention they don't have this problem. I have tried reinstalling all elements from SQL Management Studio and SQL Server and I still have this issue.
I could not reproduce this.
When I press CTRL-0 in a nullable field, it enters a NULL
When I press CTRL-0 in a non nullable field, it has the exact error message that was posted originally
SSMS version
Microsoft SQL Server Management Studio 14.0.17289.0
Microsoft Analysis Services Client Tools 14.0.1016.283
Microsoft Data Access Components (MDAC) 10.0.17763.1
Microsoft MSXML 3.0 6.0
Microsoft Internet Explorer 9.11.17763.0
Microsoft .NET Framework 4.0.30319.42000
Operating System 6.3.17763
SQL Azure version
Microsoft SQL Azure (RTM) - 12.0.2000.8 May 2 2019 20:11:13 Copyright (C) 2019 Microsoft Corporation
To be sure, I suggest you run an UPDATE and see if you get the same error
Using Management Studio 17.8.1 I added a column to my table saved and refreshed.
However when I create a database diagram making use of the table, the column is missing.
Version
Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64) Oct 28 2016 18:17:30
Copyright (c) Microsoft Corporation Express Edition (64-bit) on Windows 10 Pro 6.3 <X64> (Build 17763: ) (Hypervisor)
[Update]
The following table will display in the designer
CREATE TABLE [dbo].[Table_1](
[Id] [int] NOT NULL,
[smallId] [smallint] NULL
) ON [PRIMARY]
[Update]
Strangely the designer is even showing deleted tables.
Closing MMSM and re-opening will allow the diagrams to use the new structures.
Could it be a bug in localdb ?
When I tried altering a table I got a message
Microsoft SQL Server Management Studio has detected that an operation is blocking user input.
This can be caused by an active modal dialog or a task that needs to block user interaction.
I'm trying to add a table to my newly created database through SQL Server Management Studio.
However I get the error:
the backend version is not supported to design database diagrams or tables
To see my currently installed versions I clicked about in SSMS and this is what came up:
What's wrong here?
This is commonly reported as an error due to using the wrong version of SSMS(Sql Server Management Studio). Use the version designed for your database version. You can use the command select ##version to check which version of sql server you are actually using. This version is reported in a way that is easier to interpret than that shown in the Help About in SSMS.
Using a newer version of SSMS than your database is generally error-free, i.e. backward compatible.
I found the solution. The SSMS version was older. I uninstalled SSMS from the server, went to the microsoft website and downloaded a more current version and now the Database Diagrams works ok.
I ran into this problem when SQL Server 2014 standard was installed on a server where SQL Server Express was also installed. I had opened SSMS from a desktop shortcut, not realizing right away that it was SSMS for SQL Server Express, not for 2014. SSMS for Express returned the error, but SQL Server 2014 did not.
Just a heads up, Got the same message when I installed SQL Express 2022... Literally Installed SSMS (v18) by clicking the link after Express finished installing. I deleted V18 and downloaded V19, which is still in beta, and it fixed the problem.
if you got this error in SQL Server Management Studio (SSMS) 18.12.1 in 2022, please download Download SQL Server Management Studio (SSMS) 19 (Preview) and install it, a link is here, download the latest one, this provided link is the current latest version.
I was having the same problem, although I solved out by creating the table using a script query instead of doing it graphically. See the snipped below:
USE [Database_Name]
GO
CREATE TABLE [dbo].[Table_Name](
[tableID] [int] IDENTITY(1,1) NOT NULL,
[column_2] [datatype] NOT NULL,
[column_3] [datatype] NOT NULL,
CONSTRAINT [PK_Table_Name] PRIMARY KEY CLUSTERED
(
[tableID] ASC
)
)
Consider using other design tools like Visual Studio. You can connect to your DB from Visual Studio and use VS design tools which is very easier and faster than writing T-Sql commands.
You only get that message if you try to use Designer or diagrams. If you use t-SQL it works fine:
Select *
into newdb.dbo.newtable
from olddb.dbo.yourtable
where olddb.dbo.yourtable has been created in 2008 exactly as you want the table to be in 2012