This article supporting source code
The last time we did not implement the data in Excel and the data in the database to consolidate, there is an update, does not exist that is inserted. This is mainly about several methods to realize:
1. Using
Most developers are proud to claim that the code they write is not wrong, but in fact we all know that mistakes, both logically and physically, occur in the best projects. In other words, one of the most time-consuming tasks in the software
After a problem, the moment to solve the problem, there is always a strong sense of achievement.
In the previous project, the background database used SQL Server, and the time comparison SQL was simple, which is generally the following form:
Use the file_name function to return a logical filename for a given file identification (ID) number.
As follows:
The following example returns the file name file_id 1 (master database file).
Use master
SELECT file_name (1)
When we restore a
Two uses of functions in SQL Server (which can be used in place of cursors)
1. Because the update can not use stored procedures, but to update the table based on some of the fields to be calculated. We often use the method of the cursor, which is
The rank function is a new addition to the SQL Server2005 function. The following four rank functions are available in SQL Server2005:
1. Row_number
2. Rank
3. Dense_rank
4. Ntile
First, Row_number
The use of the Row_number function is very
There are some conflicts in SQL Server2005 for adding, deleting, modifying and querying, which can easily cause deadlock. Now there is a database of the Filedetail table is two sets of procedures to operate, a set of procedures to increase, delete,
Restoring a differential backup in SQL Server requires restoring a full backup prior to the differential backup point, adding the NORECOVERY parameter when restoring a full backup, and the sample SQL statement is as follows:
RESTORE database [DB
Case has two formats. Simple case function and case search function.
--Simple case function case
sex when
' 1 ' THEN ' man ' when
' 2 ' THEN '
Else ' other ' end
--case search function case when
sex = ' 1 ' THEN ' when
Today, an implementation of a controllable control enabled me to write this article, and this controllable control is allowed to run on the SQLSERVER2005 Enterprise Edition on the Windows200864 bit server
Using the trace flag 834,sqlserver uses
As a DBA, you often deal with some of the more difficult services that are not responding. Given the seriousness of the situation, most DBAs may use the "restart" Dafa directly to restore the normal operation of the production environment as quickly
Using database tables to construct infinite-level classifications, we usually use the following approach
The structure of this master relationship is clear, but there will be some small problems in the query; Query the descendants of all
Environment: SQL Server 2008 R2
Problem: Modifying table column names
Solve:
Modify the table's column name in SQL Server to invoke the stored procedure sp_rename.
Use test;--using the database
sp_rename ' D_s_t.avg_grade ', ' avg_g ', '
Extending a SQL Server environment across multiple systems can be said to be a difficult and complex project, involving partitioned databases, federation, and so on. So, when it comes to SQL Server scalability, most organizations prefer to take the
If the server has a raid failure, and after the data base recovery is successful, one of the SQL Server log files (extension LDF) is found to be severely damaged, and we can recover all the data by doing the following.
Start by creating a new
The meaning of four kinds of matching characters
% represents 0 or more arbitrary characters
Represents an arbitrary character
[] Any single character within the specified range
[^] Any single character not in the specified range
Strings with
Environment: SQL Server 2008 R2
Problem: When calling stored procedure sp_rename "parameter @objname ambiguous or declared @objtype (column) is incorrect".
Solve:
Look at the following commands, if you first execute the first two sentences, and
Quickly inserting Excel data from OLE DB into SQL Server, where many people stitch sql through loops, this is not only error-prone but inefficient, the best way is to use bcp, or System.Data.SqlClient.SqlBulkCopy class to implement. Not only is it
This article explains how users can customize the database repair
Automatic Application redo Log
1, the use of the set AutoRecovery command to automatically apply redo log, the completion of the data file repair operations.
Sql>startup MOUNT:
You can solve this problem by executing two counts. The first count simply calculates the raw material needed for each recipe; the second count joins the Recipeingredients table with the ingredients table before counting. Reduce the count by
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.