SQL Server doubt, suspicious, and under recovery Analysis

I. ErrorSometimes, when you restart the Database Service, you will find that some databases are being recovered, under suspicion, or suspicious. At this time, the DBA will be very nervous, the following are some methods that have been proved in

Use sys. sysprocesses to check the blocking and deadlock of SqlServer

MSDN: contains information about processes running on an SQL Server instance. These processes can be client processes or system processes.Main fields in the View:1. Spid: SQL Servr session ID2. Kpid: Windows Thread ID3. Blocked: The session ID that

Automatic and timed backup of SQL Server databases

The following is an automatic backup method that I have confirmed is available.1. Choose Enterprise Manager> Manage> SQL server proxy.2. Create a new job and take the job name as needed. For example, for data backup, select sa as the owner. Of

SQL Study Notes III various forms of select statements

Copy codeThe Code is as follows:Select * from T_EmployeeSelect FName, FAge from T_EmployeeSelect FName from T_Employee where FSalary Select FName as name, FAge as age, FSalary as monthly salary from T_Employee where FSalary Select FName as name,

Code of the SQL custom percentage conversion decimal Function

Copy codeThe Code is as follows:-- CAST and CONVERT functions PercentageDECLARE @ dec decimal (5, 3), @ var varchar (10), @ hun decimal (5, 1)Set @ dec = 0.025Set @ hun = @ dec * 100Set @ var = cast (@ hun as varchar (20) + '%'Select @ var---

SQL ntext data type character replacement implementation code

Copy codeThe Code is as follows:--- Ntext data type character replacementCreate table tt(Sid int identity (1, 1 ),Cont ntext)GoInsert into tt (cont) values (n'fd sad fdsa tujuwen tuyou Computer Information Technology Co. Ltd. may citrus ')GoUpdate

SQL statement for converting uniqueidentifier to varchar Data Type

Copy codeThe Code is as follows:--- Tu juwen Geovin DuDECLARE @ myid uniqueidentifierSET @ myid = NEWID ()Select convert (char (255), @ myid) AS 'Char ';GO-- Tu juwen Geovin DuDeclare @ allstring char (255), @ AreaUid UniqueidentifierSet @ AreaUid =

Paging code for SQL stored procedures supports hundreds of millions of data records

Copy codeThe Code is as follows:Create procedure page@ TblName varchar (255), -- table name@ StrGetFields varchar (1000) = '*', -- the column to be returned@ FldName varchar (255) = 'id', -- Name of the sorted Field@ PageSize int = 10, -- page size@

Record a successful SQL Injection Intrusion Detection with SQL Performance Optimization

However, it would be very painful for you to take over a second-class disability website and ask you to make a revision on the website. You cannot overturn the revision and can only gradually replace the old program, for example, the problem I

SQL Server allows unique Null Field Values

The following code creates a table structure:Copy codeThe Code is as follows:Create table test_tb(TestId int not null identity (1, 1) primary key,Caption nvarchar (100) null);GO Solution 1:For this question, the first thought may be: Can I add a

SPLIT string functions in SQL

I. Use a temporary table as an arrayCopy codeThe Code is as follows:Create function f_split (@ c varchar (2000), @ split varchar (2 ))Returns @ t table (col varchar (20 ))AsBeginWhile (charindex (@ split, @ c) <> 0)BeginInsert @ t (col) values

Statement for compressing ms SQL Server logs

Copy codeThe Code is as follows:-- ===================================================== ==================================-- SQL: Database compression statement------------------------------------------------------------------------ Description:

An SQL statement converts a vertical table into a horizontal table, and groups them to obtain the average and total average values.

Effect:The test SQL statement is as follows:Copy codeThe Code is as follows:Declare @ tab table (Class varchar (20), Student varchar (20), Course varchar (50), Quantity decimal (7, 2 ));Insert into @ tab (Class, Student, Course, Quantity) values

Output Parameters, return values, and result sets of Stored Procedures

Each stored procedure has a default return value. The default value is 0. Next we will look at how to view the output parameters, return values, and result set in management studio, and then how to obtain the output parameters, return values, and

Stored Procedure automatically generated by small system documents

Copy codeThe Code is as follows:Create table [order](Code varchar (50 ),Createtime datetime)-- Apply usp_ordernumbergenerate (@ prefix = 'prc100701 ')-- Input prefix category + document code + 6-digit date-- Obtain the maximum sequential number of

The distributor system throws a 18483 error and fails to connect to the server because ''distributor _ admin'' does not define remote login.

The system throws a 18483 error and fails to connect to the server, because 'stributor _ admin' does not define remote login.The following error occurs at the end of the snapshot copy setting on the distribution server:Error 18483: failed to connect

Usage of several extended stored procedures

SQL Server contains several extended stored procedures that can access the system registry. However, these extended stored procedures are not made public, and they have been available since SQL server 7.0,They are retained in SQL server 2000 and may

SQL intrusion recovery xp_mongoshell method summary

1433 SQL intrusion recovery xp_mongoshell method summaryHow to enable xp_cmdshell in SQL server 2005EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp _ Your shell', 1; RECONFIGURE;How to enable 'openrowset' in

Usage of distinct in sqlserver (non-Repeated Records)

Let's take a look at the example below: Table Field 1 Field 2Id name12 B3 c4 c5 B The library structure is like this. This is just a simple example, and the actual situation is much more complicated. For example, if you want to use a statement to

The most up-to-date data table (Data source: Google)

Provincial/Municipal/district/county Data source: Google map (including 34 provinces, 371 cities, and 2824 counties)Copy codeThe Code is as follows:/*********** Create a provincial table **********/Create table T_Province(ProID int identity (1, 1)

Total Pages: 923 1 .... 839 840 841 842 843 .... 923 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.