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
A few days ago found that the site's query a bit abnormal, in general, will first query the contents of a directory, click a table of contents will be queried after the level two directory. Until the bottom of the query to the file. But these days
i): Definition of view
A view is a virtual table defined by a query based on one or more tables, which saves the specific definition of the query, and the view contains no data.
The view has no difference in operation from the datasheet, but the
Today, use the example to summarize the usage of group by.
Sum up: Group By:all, Cube,rollup,compute,compute by
Create a data script
Create Table Salesinfo(ctiy nvarchar (50),OrderDate datetime,OrderID int)
INSERT INTO SalesinfoSelect N '
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
The first is the way to add a datasheet to a partitioned table:
[dbo]. [Sp_helper_partition_add]
@SrcTable nvarchar (256), table to be added
@DestTable nvarchar (256), target table
@idxOnDest nvarchar (1024), index creation statement on the target
Give an example to specify:There are two table SourceTable for the landing table, targettable for authorization table, if the access user in the landing table, Update authorization table authorization level, otherwise authorized 0 for visitors. The
By experience, this is an index fragmentation problem. Check the index fragment DBCC SHOWCONTIG (table) and get the following results: DBCC Showcontig is scanning the ' A ' table ...Table: ' A ' (884198200); index id:1, Database id:13A TABLE-level
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 following methods can be used to quickly generate a batch of data
if (object_id (' t ') is not null) drop table T
Go
CREATE TABLE t (ID int identity (1,1), name varchar (40))
Go
Insert into T (name) select NEWID ()
Go 10
SELECT * FROM t
/*
1 18
For repeated row deletion problem, the Internet is difficult to find the right answer, ask a lot of questions, but in the search engine cursory look at the previous record there is no solution.
In fact, this problem can be very gorgeous solution.
1,
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
Nonclustered index, this is a very familiar thing, sometimes we for business reasons, SQL write very complex, need to join a lot of tables, and then burst into tears ... At this time there is a DBA or Senior developer to show you this wretched SQL,
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
Regular backups of the SQL Server database are often required. Regular backup to this machine, or quite easy, planning tasks can be completed, but if the machine is hung, that backup to this machine is meaningless, then you need to consider backup
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service