In addition to the basics of table triggers, this article also uses a bit of knowledge.1. How to use SQL to get the current session user name and machine nameSelect current_user, HOST_NAME ()2. How to get the current table name in a table
SET QUOTED_IDENTIFIER ONIdentifiers can be delimited by double quotation marks, and literals must be delimited by single quotation marksSET QUOTED_IDENTIFIER OFFIdentifiers are not quoted and must comply with all Transact-SQL identifier rules.SET
Set IDENTITY_INSERT on and off in SQL Server:Execute INSERT Database Insert data times the following error, I clearly did not give the primary key set value but still errorHere's how to fix it:Qlserver when you insert a record in bulk, set the SET
In the process of using SQL Server, we may need to copy the table from one database to another, and today I'll show you how and how to do this. It may be a simple thing for most people, but it is better to record it than to write a good memory. Hope
1. Remote Login mode2. Query the first 100 dataSelect top * FROM [dbo]. [Flow_share_day_tax]3. Get the system timeSELECT GETDATE () as ' current time 'Get other Time:DATEPART () returns an integer representing the specified date part of the
Problem Description:When a client server does not allow direct backup, it is often deployed by exporting database scripts-restoring the database,However, when the database export script is large, when you execute a script with Microsoft SQL Server
BACKUP database name to disk= ' D:\3333.bak '---Generate file names based on time--Assigning a SQL script to a variableDeclare @SqlBackupDataBase as nvarchar (1000)Set @SqlBackupDataBase =n ' BACKUP DATABASE House to DISK = ' E:\DBBackup\HOUSE-'
/*sqlserver exception capture in SQL Server database, if there are many stored procedures, we use dynamic SQL for stored procedure call stored procedure, at this time, it is possible to make a mistake at some point, but the error we can not trace to
Previously, I wanted to record some of the usual functions of SQL, but it has not been implemented ... Hey...Until today, the substring () function is used, and in C # The starting value of this method is 0, and the starting value in SQL is 1. Silly
Iv. RankingSorting and ranking is our most commonly used statistical method, such as the class of students according to the ranking of members, or according to the score of the students divided into several echelon: for example, the best results of
method One: fix SQL Server:If you encounter a restart of the computer during the repair process:1. Press the key combination "Win" + "R" to bring up the running window2. Enter "regedit" and find the following location in the left-hand directory of
Method OneDeclare @max integer,@id integer DeclareCur_rowscursorLocal for SelectMain field,Count(*) fromTable nameGroup byMain field having Count(*)> 1 Opencur_rowsFetchCur_rows into @id,@max while @ @fetch_status=0 begin Select @max = @max -1 Set
File and filegroup deletion, if because the previous partition scheme is unreasonable, need to cancel partition, or partition in another way, you need to involve the deletion of files and filegroups, if not mastered the correct steps, sometimes can
Some methods of SQL Server to estimate and calculate the estimated number of rows are discussed.
About the base Estimation in SQL Server 2014, the official document Optimizing Your Query Plans has a lot of details in the SQL Server 2014 Cardinality
SQL Server 2016 no-domain cluster configuration AlwaysON availability group graph tutorial, 2016 alwayson
Both windows server 2016 and SQL server 2016 can be used to allow users not to join the AD, saving a lot of management operations, and there is
SQL where, group by, and having usage parsing, sqlhaving
If you don't talk much about it, paste the Code directly. The specific code is as follows:
-- SQL where, group by, and having usage parsing -- if you want to use group by, you generally use
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.