Altered table structures not available in database diagram (localdb) - sql-server

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.

Related

How to know who has updated the table in SQL server?

I want to know who has modified the table in the SQL server, But I couldn't find any authentic solution for this.
I tried function fn_dblog, but it is not allowing me due to some permission issue.
SELECT * FROM fn_dblog(NULL, NULL)
Error Message:
Msg 229, Level 14, State 5, Line 1 The SELECT permission was denied on
the object 'fn_dblog', database 'mssqlsystemresource', schema 'sys'.
I refereed this article, but the link for the fndblog2 function expired.
Basically, I want to get the list of users who have updated the given table, if it is modified in SSMS then user details and if it is modified by some .net application then .net application name.
SSMS details: Microsoft SQL Server 2019 (RTM-CU10) (KB5001090) - 15.0.4123.1 (X64) Mar 22 2021 18:10:24 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)
Note: Privelleged Permission can't be given to me due to securities issues. I am fine with writing a C# application. I am ok with writing C# appication if it is possible in C#.

SQL Server Always Encryption - Query Stuck in Executing State

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.

How to set a specific cell to null in SQL Management Studio in combination with SQL Azure

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

sql server - How to properly insert/update data with central european characters

I have a proprietary software that communicates with sql server database for storing data and trying to insert/update records behind the scenes.
Running Select ##version on server returns
Microsoft SQL Server 2014 (SP2-GDR) (KB4019093) - 12.0.5207.0 (X64)
Jul 3 2017 02:25:44
Copyright (c) Microsoft Corporation
Express Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
server collation is Slovenian_CI_AS, but all string columns in tables are declared with:
DATA_TYPE: nvarchar
CHARACTER_SET_NAME: UNICODE
COLLATION_NAME: SQL_Latin1_General_CP1_CI_AS
Now if I try updating a field, for example:
UPDATE CategoryText SET Title = 'č' WHERE Category_Id = 1 AND LanguageId = 1060"
The software displays Ä as a title.
Of course, I get the right result (letter č) if i run the following query from the console
select Title from CategoryText where Category_Id = 1 AND LanguageId = 1060
But I would like to insert the text the way that will be displayed properly in the software.
Doing this from ubuntu with en_US.UTF-8 local settings, tried also from windows without luck.
I can change my local settings, I can change the collation of the string I'm importing.
I cannot change the way software is communicating with the server and I do not think I can alter the tables in the database.

Stored procedure doesn't do anything in remote server when called with "Exec procedure"

I'm puzzling with a Stored procedure that has different behavior when run with an withoout the Exec keyword.
I have 2 servers, Server 1:
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.0 (Build 6002: Service Pack 2) (Hypervisor)
Server 2:
Microsoft SQL Server 2008 (SP2) - 10.0.4000.0 (X64) Sep 16 2010 19:43:16 Copyright (c) 1988-2008 Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (VM)
A stored procedure (ACTUALIZA_MANTE_FULL) in Server 1 that deletes and inserts data to a table in Server 2 from tables in server 1.
When I run "EXEC ACTUALIZA_MANTE_FULL" the process returns no errors but the destinatio table has no rows.
When I run "ACTUALIZA_MANTE_FULL" (without EXEC) the process runs with no errors and the data is inserted correctly.
Why the difference?, what i'm missing?
EDIT: procedure pseudo code (sorry can't put actual code)
CREATE PROCEDURE MIPROC<br>
AS <br>
declare #from datetime<br>
set #from = getdate()-30<br>
<br>
delete from [ADMSRV].remotedb.dbo.remoteTable where t_date >= #from<br>
<br>
Insert into [ADMSRV].remotedb.dbo.remoteTable <br>
Select fields, sum(datum) as datum<br>
form localdb.dbo.localtable1<br>
where ld_date >= #from<br>
group by ields <br>
union <br>
Select fields, sum(datum) as data<br>
form localdb2.dbo.localtable2<br>
where ld_date >= #from<br>
group by fields<br>
GO<br>
the fields in (fields) are same cuantity, and type of PK in remoteTable
Remote table has PK only, no FK, no unique constraint, no unique index or triggers.

Resources