In the developer database (MS SQL Server) I had a field, in which all the values were the same. The value was "OldDoc.txt". I wanted to make values unique and for this I wanted to add "ID" before ".txt".
(read more...)In the developer database (MS SQL Server) I had a field, in which all the values were the same. The value was "OldDoc.txt". I wanted to make values unique and for this I wanted to add "ID" before ".txt".
(read more...)If you need to select the records between 2 dates in MS SQL, where the DateTime column contains both Date and Time, you can use SQL functions for WHERE clause and avoid of adding the time information like '23:59:59.000'. Though you can do it and this way.
(read more...)I work with a WebApi project in Net.Core and MS SQL Database. MS SQL server is executed in Docker container. Suddenly I found out, that ID field value with autoincrement has increased from 2 to 1001.
(read more...)Short manual how to execute MSSQL server in Docker in Windows 11. For linux there are the same steps but instead of PowerShell you should use terminal and don’t forget about sudo.
(read more...)We have a table with columns Id (GUID), Title (nvarchar(50)), PubDate (DateTime). After several tests there were inserted a lot of records and many of them have been inserted more than 1 time. The task is to 'seek and destroy' all the duplicate elements and to leave only unique rows.
(read more...)The task is to build a tree in a table with parentID from bottom to top. It's useful for generating hierarchy strings, lists or any other types. You can also create a storage procedure of this and it will make it easy to use in queries.
(read more...)After installation of MS SQL Server 2012 on Windows Server 2012, I had gotten these errors in Event Viewer on execution server:
The server was unable to initialize encryption because of a problem with a security library. The security library may be missing. Verify that security.dll exists on the system.
TDSSNIClient initialization failed with error 0x139f, status code 0x80. Reason: Unable to initialize SSL support. The group or resource is not in the correct state to perform the requested operation.
TDSSNIClient initialization failed with error 0x139f, status code 0x1. Reason: Initialization failed with an infrastructure error. Check for previous errors. The group or resource is not in the correct state to perform the requested operation.
Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.
SQL Server could not spawn FRunCommunicationsManager thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.
I must notice that I had an old distributive of MS SQL Server 2012.
(read more...)To create a full backup of MS SQL Server database with compression use this SQL command:
use YourDataBaseName go BACKUP DATABASE YourDataBaseName TO DISK = 'Z:\BACKUP_FILE_NAME.bak' WITH COMPRESSION
According to database size and your server capabilities, backup time can vary.
There are at least 3 ways to find out if the column in table exists in MS SQL server. It's a common task for developers or administrators when you need to modify table.
If you have installed MSSQL Server without a key and chosen an Evaluation version, once it will be stopped because of this. Of course, on this day you will have to show something in your environment.