1. Database
Copy Code code as follows:
--Size of all databases
EXEC sp_helpdb
--Status of all databases
Select Name,
User_access_desc,--User access mode
STATE_DESC,--database state
Recovery_model_desc,--Recovery model
In the daily application, often according to the actual requirements of the input of some values, and these values can not be used directly, so in SQL often on the field value of some conventional processing. Collected here (extract the number,
--sql Determine if the field value has a Chinese create function fun_getcn (@str nvarchar (4000)) returns nvarchar (4000) as BEGIN declare @word NCHAR (1), @CN nvarchar (4000) Set @CN = ' while Len (@str) >0 begin set @word =left (@str, 1) if
One requirement is to store multiple states in a cloud-monitored state value (including various exceptions, warning states that can exist simultaneously) using a bitwise operation mechanism to store in an int.
Now the monitoring log data is very
I. ProblemsGives two tables with forty or fifty columns and finds the same columns and different columns
Second, query two table columns, there is a temporary table
--#a, #b都是临时表, automatically deleted after the current connection is disconnected--
Use the following script to view the size of the database index fragmentation:
Copy Code code as follows:
DBCC showcontig with FAST, Tableresults, All_indexes, no_infomsgs
The following scripts are used to process maintenance
Script Source:
Copy Code code as follows:
SET ANSI_NULLS on
Go
SET QUOTED_IDENTIFIER ON
Go
CREATE Procedure[dbo]. [Serializejson] (
@ParameterSQL as VARCHAR (MAX)
)
As
BEGIN
DECLARE @SQL NVARCHAR (MAX)
DECLARE @XMLString
In the Tutorial Windows2003 Server installation and Setup Tutorial--mssql Security Chapter One (with MS SQL Server running under ordinary users), the author said 11th step "after setting the permissions on the directory, you need to set the running
Test Cases
We create similar objects in the user database (testpage), tempdb, T1, #t1, create a non temp table in tempdb, then execute the corresponding insert script (to produce the log), and record the execution time for comparison to describe
The has been used since the start of the project. The original of this stored procedure (SORRY, forget the name), write this section of the SQL code is very good, I on this basis, according to my habits and thinking mode, adjusted the code, only to
Using SQL Server as a database application system, can not avoid the sometimes deadlock, deadlock, maintenance personnel or developers will only through the sp_who to find the deadlock process, and then kill with Sp_kill. Using Sp_who_lock, this
Looked at the cloud Habitat Community online Many articles, sorted out the following steps, basically can be said to be the end of the solution, here to the detailed collation, hoping to help the updated friends, so that our server more secure.
One: A trigger is a special stored procedure that cannot be invoked explicitly, but is automatically activated when you insert records into a table ﹑ update records or delete records. So triggers can be used to implement complex integrity
Example: The company staff to take three shift system: 0:00 to the morning 8:00 for the first class, 8:00 to 4:00 for the second shift, 4:00 to the evening 12:00 for the third class.
The employee signs with an electronic clock that automatically
SQL error log records the database running process encountered a variety of problems and some important information, as a problem, we usually do not take the initiative to clean up these log files, only every time the server restart, SQL will
Open SQL Server Enterprise Manager, and suddenly a window pops up, which reads:
Error Tip:
The Microsoft Management Console
—————————
MMC cannot open file C:Program filesmicrosoft sql Server80toolsbinnsql Server Enterprise manager.msc.
This may
--Data manipulation SELECT-Retrieving data rows and columns from database tables INSERT-Adding new data rows to a database table Delete-deleting data rows from a database table UPDATE- Update data in a database table --Data definition CREATE
This article is to introduce you to the correct optimization of the SQL Server database experience, including in the actual operation of its optimization should be noted in the local description, as well as the most basic principles of the
Steps to manually implement differential backups
Character type:
1. Restore the current libraryALTER DATABASE Current library set RECOVERY full--
2, the construction table cmd; Create table cmd (a image)--
3, back up the current library to
1.OUPUT parameter return value
Copy Code code as follows:
CREATE PROCEDURE [dbo]. [Nb_order_insert] (
@o_buyerid int,
@o_id bigint OUTPUT
)
As
BEGIN
SET NOCOUNT on;
BEGIN
INSERT into [order] (O_buyerid)
VALUES
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.