If your hard disk space is small and you do not want to set the database log to be minimal (because you want other normal logs to still be logged), and high speed requirements, and clear all the data suggest you use Turncate table1, because truncate
According to the network situation, may reach 10 seconds of delay, that is, the main database added, deleted, updated content, generally in 10 seconds can be synchronized to the standby database.
Three-minute video operation demo at the bottom, don'
1. Open MS SQL Server Enterprise Manager, SQL Server Group-management-database maintenance plan
-Right-click the new maintenance plan as shown below:
Next: Select the database you want to back up
Next:
Continue to the next step:
Next:
The following are shown in the Illustrated form:
First, SQL Profiler
Event class Stored procedures\rpc:completed tsql\sql:batchcompleted
Event-critical Fields Eventsequence, EventClass, SPID, DatabaseName, Error, StartTime, TextData, HostName,
Today's article, I want to give you a brief description of how to set up random recordsets in SQL Server.
SELECT * from Person.person
-NEWID () go
This introduces a new uniqueidentifier data type column, where SQL Server does a physical
SELECT Ps.name as Psname,
Dds.destination_idas partitionnumber,
fg.name as Filegroupname,fg.name,
t.name ,
f.name as FileName from
(((sys.tables as T
INNER JOIN sys.indexes as I
(t.object_id = i.object_id))
inner join
The following trigger are used to monitor changes to stored procedures.To create a monitoring table:
CREATE TABLE auditstoredprocedures (
DatabaseName sysname
, objectname sysname
, LoginName sysname
, ChangeDate datetime
, eventtype sysname
,
But I think this feature is also useful for setting up a backup server or a test server.
On a single machine to publish services, you can subscribe to other machines in the SQL, according to your release of different conditions, you can make a
In a large database, changes in data are very frequent.
The indexes built on these data also need to be maintained frequently.
Otherwise, these data indexes do not play a role. Can even become a burden on the database itself.
We have to maintain the
The following cross apply and outer apply keywords in SQL Server are presented as follows:
1.CROSS Apply and outer apply
The MSDN explanation is as follows (personal understanding is not very clear):
Use the APPLY operator to call a table-valued
We all know the number of rows that can be counted with the aggregate function count (). The count () function must generate a dynamic SQL statement for each table and execute it to get results if you need to count the number of rows per table for
Copy Code code as follows:
@echo off
set/p choi= Start the database, stop the database [B,e]?
if/i%choi% equ b goto beginserver
if/i%choi% equ e goto endserver
: Beginserver
NET start MSSQLServer
Goto END1
: Endserver
net stop
Copy Code code as follows:
--Create a log table
CREATE TABLE triggerlog (loginfo XML)
--Create a dummy table to delete later on
CREATE TABLE tabletodelete (Id int PRIMARY KEY)
--Create a new table as a delete test table
INSERT into
DECLARE @TopCount intSet @TopCount = 100Select Top (@TopCount) * from AdventureWorks.HumanResources.EmployeeIf you have like words, be sure to spell SQL, you should also use sp_executesql to perform, examples are as follows:DECLARE @TopCount
The official Reference Document
Http://technet.microsoft.com/zh-cn/library/ms187074%28SQL.90%29.aspx
They work between comparison operators and subqueries, similar to exists, not exists, in, and not, and other logical meanings, which are also
Recursion refers to the case where the code fragment calls itself; the danger is that if you call itself once, then how to prevent him from repeatedly calling itself. This means providing a recursive test to ensure that the appropriate time to jump
Originally wanted this series to write something good, then think of everyone as a programmer, use the most is the database, but in fact many like me to work in the first line of the code farmers, a little knowledge of SQL, do not talk about
Preface: Any optimization and modification are based on the business situation as a prerequisite, may have written wrong or inaccurate place, welcome you to shoot bricks.
1. When creating DB, the growth proposal is set to increase in MB (M), the
Sometimes it may be necessary to detect the service of a certain machine is not up, or whether a library of a machine can be connected and can not open SSMs also do not want to log on to the server can use this method.
1. Right-click on the desktop
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.