For MS SQL Server databases, there are several issues that are misleading and, even though many SQL Server DBAs are wrong or not fully aware, I would like to write a few articles that explain these easy-to-understand mistakes in depth, I also hope to correct the online misinformation of these problems (I may also have
The logical design of database is a very broad problem. In this paper, the main key design of the table is discussed in the design of MS SQL Server in the development application, and the corresponding solution is given.
The status and problems of primary key design
As for the primary key design of database tables, it is generally based on business logic to for
Tags: sql database sysobjects sysdatabases syscolumnsStores all system information for SQL. Stores metadata about the database service so-called metadata (such as which user databases the data server has, which login accounts the database server has, which tables are in the
Create temporary table Method 1:Create Table # temporary table name (Field 1 constraints,Field 2 constraints,.....)Create Table # temporary table name (Field 1 constraints,Field 2 constraints,.....)Method 2:Select * into # temporary table name from your table;Select * into # temporary table name from your table; Note: The above # indicates a local temporary table, and # indicates a global temporary table.
Query temporary tablesSelect * from # temporary table name;Select * from # temporary tabl
To ensure that SQL server returns the correct value or has performance concerns, it intends to re-compile the execution plan without reusing the execution plan cached in the memory, it is called recompile ). Which of the following conditions can cause re-compilation of the stored procedure? In order to ensure that the correct value or performance concerns are returned, Luo SQLSERVER intends to re-compile th
Tags: style blog http io ar os using SP strongOriginal: SQL Server 2008|2012 block save changes requiring re-creation of tablesIt is not very understandable why the option to block saving changes that require re-creation of tables is included in SQL Server 2008 and later ver
For ms SQL Server databases, there are several problems that are easy to misunderstand. For these problems, even if many SQL Server DBAs have incorrect understanding or insufficient understanding, therefore, I want to write a few articles to elaborate on the problems that are easy to understand and make mistakes. I als
1. View tables and viewsSELECT * from sys.objects WHERE object_id = object_id (' table name or view name ')In SQL Server, you can generally find the results by querying the sys.objects system tables, but there are more convenient waysAs follows:If object_id (' tb_table ') is not nullprint ' exist 'Elseprint ' not exist
Emptying records from all data tables in SQL ServerClear all records in the data table:The code is as follows: exec sp_msforeachtable @Command1 = ' truncate table? 'Delete all data tables:The code is as follows: Exec sp_msforeachtable ' delete N '? 'Method of emptying all table data in a SQL Server database (constraine
4
Figure 5
5. Save SQL Server 2000 (Extended) into an xdb file.
6. Now we can create a new Physical Data Model. Select SQL Server 2000 (Extended) as the database Model ). To create a table, you must specify a database user. Generally, dbo is used (figure 6 ). We can add comments to both
transactions from using this table during a transaction READPAST let SQL Server skip any locking lines, perform transactions, apply to READ UNCOMMITTED transaction isolation LEVEL only skip RID lock, skip page, zone and table lockRowlock forcing the use of row locksUplock forcing updates to be used when reading tables without sharing locks To view the locked ta
For complex queries, we can use nested and complex SQL statements, but sometimes it is more convenient and efficient to use temporary tables.
SQL Server supports temporary tables. A temporary table is a table whose names start with a pound sign. If the temporary table is no
It is not very understandable why the option to block saving changes that require re-creation of tables is included in SQL Server 2008 and later versions. It is too troublesome to be "blocked" every time the table structure is modified. It's not convenient. Problem Description:The solution to the error of SQL
What is the reason why SQL Server table hints cannot modify the table structure? Here's how to handle the problem, and if you've had problems with SQL Server table modifications, you might want to take a look.The newly installed SQL Serv
publishing side with the verification subscription function at the publisherMethod Seven: Compare the checksum values of the contents of two tables with checksum checkBut this approach is only confined to the two-table structure.I copy the data from the [t1_new] table to a new table for comparisonSELECT * from [dbo].[t1_new]SELECT * from [dbo].[T1_newreplica]SELECT SUM(CHECKSUM (*)) asChecksumvalue from [dbo].[T1_old]SELECT SUM(CHECKSUM (*)) asChec
SQL Server temporary tables are frequently used. The following describes how to use SQL Server temporary tables to prevent repeated user logon.
When developing business software, we often encounter the following problem: how to pr
' From SYS. dm_db_partition_stats As PS Inner Join SYS. Objects As So On PS. Object_id = So. Object_id Where Index_id 1 And So. Type = ' U ' Group By So. Name, so. Type Order By Sum (Row_count) Desc -- -------------------------------------------------------------------- /* DBCC statement: This command set is used to check SQL server statistics, trace activities, and check database
In SQL Server 2005/2008, if an ordered record is inserted into a staging table, the records queried from the staging table are ordered (not dependent on order by and ordered), but starting with SQL Server 2012, even if the inserted recordset is orderly, The result of the query becomes unordered. You need to rely on ord
Tags: style blog color io os using AR for fileSQL Server deletes all tables in the database-------------------------------------------------------------------------------------------Open SQL Server Management Studio and create a new query in the Open XXX. In the SQL file, en
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.