SQL Server Alwayson master-slave database account synchronization

After we set up Alwayson, there is no corresponding account in the database under the secondary copy. How to synchronize the account? How to set the account synchronization without knowing the password.   We can use SP -- sp ﹣ help ﹣ revlog in. This stored procedure is created on the primary copy. When executing, the SQL command will be gen ...

Posted by shapiro125 on Thu, 07 Nov 2019 08:47:03 -0800

WITH CUBE, WITH ROLLUP, and GROUPING tests in GROUP BY

A few days ago, I saw a group of friends using WITH ROLLUP. Because they didn't use it, I had no time to test it. 1. Concept: WITH CUBE: the resulting set shows the aggregation of all combinations of values in the selected column. WITH ROLLUP: the resulting set shows an aggregation of a hierarchy of values in the selected column. Group: whe ...

Posted by evilmonkey on Mon, 04 Nov 2019 12:02:42 -0800

Random Name Generation Method

 From: http://www.maomao365.com/?p=10025 Abstract: Following is the method of using sql script to generate Chinese names to share, as follows: Experimental environment: sql server 2008 R2 In our work, we sometimes need to generate random names in batches. The following will describe how to use sql scripts to generate random "names&qu ...

Posted by blui on Sat, 12 Oct 2019 10:49:27 -0700

SQL Syntax Hint Tool SQL Prompt - On adding NOT NULL columns or making nullable columns NOT NULL

SQL Prompt is a useful SQL syntax prompt tool.It automatically retrieves object names, syntax, and code snippets based on the database, providing users with appropriate code choices.Automatic script settings make the code easy to read - especially if the developer is not familiar with scripts.The SQL Prompt installation is ready to use and can ...

Posted by gabrielkolbe on Mon, 26 Aug 2019 19:18:48 -0700

Why should the @@IDENTITY function be avoided in SQL Prompt, a SQL grammar prompt tool?

SQL Prompt It is a practical SQL grammar prompt tool. SQL Prompt automatically retrieves the database object name, grammar and code fragments to provide users with appropriate code selection. Automatic script settings make code easy to read -- especially when developers are not familiar with scripts. SQL Prompt can be installed and used, which ...

Posted by UTAlan on Tue, 13 Aug 2019 03:15:09 -0700

SQL SERVER Implementing Multi-row to Multi-column

There is such a requirement, a form main table, an extended list, query to expand the list of multi-row into the main table multi-column. such as dt_zhubiao [main table] id type title 1 1 Form 1-1 2 1 Forms 1-2 3 2 Form 2-1 4 2 Form 2-2 dt_kuozhanbiao [Extended Table] id formid name title value 1 1 ext_ ...

Posted by Mikersson on Fri, 09 Aug 2019 03:48:00 -0700

SQL Server -- Get Disk Space Usage

For DBA, monitoring disk usage is a necessary task. There is no easy way to obtain disk space usage information. Here's a summary of the scripts saved over the years: The most commonly used way to view disk free space, which is a must-remember entry to DBA: -- View Disk Available Space EXEC master.dbo.xp_fixeddrives The xp_fixeddrives m ...

Posted by cooler75 on Tue, 16 Jul 2019 11:46:51 -0700

UDAF Debugging Based on Custom Log Printing

See some recent users, code debugging in the local IDE environment after successful debugging, debugging online results do not meet expectations. Because IDE cannot simulate the scenario of distributed debugging UDAF by multiple worker s, some BUG s may need to be debugged online with some simple test data. Here we use the simplest method of ma ...

Posted by Haberdasher on Sat, 20 Apr 2019 21:33:34 -0700

SQL SERVER - Talking about the Solution of Deadlock Monitoring and Analysis

1 background 1.1 Alarm Recently, I have been sorting out my notes and intend to migrate them all to EVERNOTE. Tidy up to the lock part, there happens to be a case recorded by myself, reorganize and share it to you. One day at noon, received alarm messages, DB deadlock abnormal, one minute deadlock 120. The deadlock xml file is as follows: ...

Posted by blyz on Sat, 13 Apr 2019 09:18:33 -0700

Conversion from 10 to 33

1, start I saw this question post on CSDN yesterday:< Writing a stored procedure from 10 to 33 in SQL The question of the original post is as follows: Urgently seek 10-to-33-digit code. I want to create a stored procedure "T10TO33" in SQL to convert 10-digit data into 33-digit data. The 33-ary rule is: 1,2,3,4,5,6,7,8,9,A,B, ...

Posted by koolswans on Sun, 24 Mar 2019 23:09:29 -0700