The site of a database log file has reached the point of 150 g, the data file is dozens of m, through the normal operation to shrink the log:> database right → task → shrink → file, in the popup window, file type select "Log", shrink option Select
How SQL Server sets the primary key auto-increment1: Open SQL Server, connect to the database, locate the target table, right-click, and then tap Design.2: Click the primary key column (or any other column that you want to set for the data type int),
Use db_buinessGoSelect *from dbo. warehouse WHERE city = ' Beijing 'SELECT DISTINCT (city), warehouse number from dbo. Warehouse//Cancel Duplicate column valuesSelect SUM (wages) as the total wage from the dbo. StaffSelect warehouse number, city,
Sometimes we need to share data with third parties, but we don't have a completely open database. Therefore, the use of database role authorization can be a good solution to this problem. The following are the SQL statements used in the work. Just
1 , creating a batch file
@echo offSet dates=%date:~0,4%%date:~5,2%%date:~8,2%Set rar= "%programfiles%\winrar\winrar.exe"Set rand=%random%Set folder=d:\dbback\%date%REM Creates a folder every day, named after today's dateIf not
Connection queries are the most important queries in relational data, including inner joins, outer joins, and so on. You can implement multiple table queries by using the Join operator. The INNER JOIN query operation lists the data rows that match
A nested query refers to a query that is nested inside another query statement. A nested query is also a subquery, in which a subquery is evaluated first in the SELECT clause, and the subquery results as a filter for the outer layer of another query,
Back up the original file before transferring move tempdb from its current location on disk to a different disk location. Because tempdb is recreated every time the MSSQLSERVER service is started, you do not need to move data and log files
Some common uses of triggers:◊ Enforce Referential integrity◊ Common audit trails (Audit trails): This means that the written records not only track most of the current data, but also include historical data that is actually modified for each record.
1. Types of ConstraintsConstraints can be divided into 3 main categories: Entity constraints, domain constraints, and referential integrity constraints.1.1> entity constraintsEntity constraints are all about comparing rows, and entity constraints do
Recursive format:With CTE name (field list) as ( Query Statements ) Get all subordinate department statements for the current department:Create function getchildrendepartments (@currentdepartid int)Returns tableAsReturnWith CTE
-------------------------------------------------------the first query to see how many tables in the library, table names, and so on select * from INFORMATION_SCHEMA. TABLES;-------------------------------------------------------the second query
Source: SQL SERVER 2005 gets all the index information for the table and deletes and creates a new statementBEGIN with TX as (SELECT a.object_id, b.name as Schema_name , A.name as TABLE_NAME, c.name as Ix_name, C.is_unique as Ix_
Today we take some time to learn about SQL Server databases, including how to create databases, create tables, SQL Server data types, data integrity, design databases, SQL Server security models, and T-SQL statements, and so on. I hope you can have
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.