How to know who has updated the table in SQL server? - 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#.

Related

SqlServer Internal Error dm_os_enumerate_filesystem -- alloc\storagedmv.cpp

I recently started using sys.dm_os_enumerate_filesystem.
My SQL Server version is:
(Microsoft SQL Server 2017 (RTM-CU31) (KB5016884) - 14.0.3456.2 (X64) Sep 2 2022 11:01:50 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2012 Standard 6.2 (Build 9200: ) (Hypervisor) )
Everything worked fine until I started querying filesystems where the directories are very large.
The following query generated the error:
SELECT *
from sys.dm_os_enumerate_filesystem('F:\technician','*');
Msg 407, Level 16, State 1, Line 15
internal error. The string routine in file sql\ntdbms\storeng\dfs\alloc\storagedmv.cpp, line 799 failed with HRESULT 0x8007007a.
The directory is 460 GB. I have also checked all permission and SQL Server service has all permission on the above directory.
As you can see the SqlServer is running with the last CU31.
Is there a workaround?

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.

Enable File Stream SQL Server 2017

I am trying to enable file stream on Microsoft SQL Server 2017, on a Windows Core 2019 Server.
I have changed the registry settings at the following location to enable it as there is no GUI. I set the value to 3
ServerName\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL14.InstanceName\MSSQLServer\Filestream.EnabledLevel
After This I restarted
I have also installed the latest Cumulative update (20) as I know there where issues with Driver signing.
After This I restarted
I am seeting the following Errors in the log file at C:\Program Files\Microsoft SQL Server\MSSQL14.InstanceName\MSSQL\Log
<{781FAE78-09AB-4EE5-B051-67747BDB19E3}>RsFxMgmtInitialize failed (the RsFx device is not found. Check if RsFx driver is started.): Error 0x80070002 (-2147024894)
2020-04-21 08:56:03.94 spid5s FILESTREAM: failed to connect to kernel driver RsFx0503.
<{1038F43D-3391-45F7-B1B3-BADF26459429}>Failed to initialize CFsaShareFilter: Error 0x80070002 (-2147024894)
<{1038F43D-3391-45F7-B1B3-BADF26459429}>Failed to initialize CFsaShareFilter: Error 0x80070002 (-2147024894)
2020-04-21 08:56:03.94 spid5s FILESTREAM: effective level = 0, configured level = 2.
2020-04-21 08:56:03.94 spid5s FILESTREAM feature could not be initialized. The operating system Administrator must enable FILESTREAM on the instance using Configuration Manager.
SELECT ##VERSION
Microsoft SQL Server 2017 (RTM-CU20) (KB4541283) - 14.0.3294.2 (X64) Mar 13 2020 14:53:45 Copyright (C) 2017 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) (Hypervisor)
I got this working on one server and cannot get it working on the second one.
There is also a version of sql 2019 on this box
Any help? Also any advice on getting this working on a cluster
I used "computer management" and remotly connect to your core server. From there, you can enable FileStream and configure it.
This seemed to work better that the registry method

SSDT Data comparison, login failed

When ever I try to proceed to the second step in the comparison, it displays a message saying that it cannot connect with the login I provided (sqlAuth not win).
Note A: It will let me run queries and even do a schema comparison, but no luck with data comparison.
Note B: localhost works fine.
Versions:
Remote:
Microsoft SQL Server 2012 - 11.0.2100.60 (X64) Feb 10 2012 19:39:15
Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on
Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)
Local:
Microsoft SQL Server 2014 (RTM-CU14) (KB3158271) - 12.0.2569.0 (X64)
May 27 2016 15:06:08 Copyright (c) Microsoft Corporation Express
Edition (64-bit) on Windows NT 6.3 (Build 10586: )
There have been a number of connection-related fixes in the latest SSDT 16.5 release. I just worked through a similar issue with a partner building SSDT demos, and updating to latest resolved issues in Data and Schema compare for SQL Authentication with them. Specifically, there were issues where the "Remember Password" checkbox wasn't preserved which was causing issues, so you may need a one-time action to enter the password so that it's re-saved correctly.
Disclosure: I work on the SQL Server tools team.
I'm having similar issues with SQL Server auth.
Possible answers are listed on this similar question: https://dba.stackexchange.com/questions/102605/azure-sql-database-login-failed-for-user-in-application-but-works-fine-in-ssm
Which links to https://social.msdn.microsoft.com/Forums/sqlserver/en-US/74d2b7f0-09f2-4ef3-935b-e0a1e0e8fb82/schema-compare-target-unavailable?forum=ssdt

Can't Restore Azure SQL V12 bacpac to a local SQL 2014 server

Since we upgraded some of our Azure SQL servers to V12, we can no longer restore a bacpac locally using command line sqlpackage.exe. We also tried using Management Studio, but no dice.
Our local developer machines are running:
Microsoft SQL Server 2014 - 12.0.4213.0 (X64)
Jun 9 2015 12:06:16
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.3 (Build 9600: )
Here is the error we encounter:
*** Error importing database:Could not import package.
Error SQL72014: .Net SqlClient Data Provider: Msg 33233, Level 16, State 1, Line
1 You can only create a user with a password in a contained database.
Error SQL72045: Script execution error....
This looks like it is having issues creating the users that were added by scripts.
Is anyone else running into this issue?
Update:
Apparently this has been a reported problem since April. https://social.msdn.microsoft.com/Forums/sqlserver/en-US/85bb12e8-5ae4-409c-93fa-8a9d025c6b35/error-when-importing-a-datatiers-application-from-azure-db-as-contained?forum=ssdt
The work around from the above post works. You need to modify the bacpac file and create a new checksum: http://inworksllc.com/editing-sql-database-azure-bacpac-files/
This is a workaround, not a fix.
Update: Looks like there will be a fix soon.

Resources