SQL Server connection query details, SQL Server Query details
When querying multiple tables, we often use "join query ". Connection is the main feature of the relational database model and a symbol that distinguishes it from other types of database management systems.
What is connection query?
Concept: query data from
1. View the version of the database
SELECT @ @version
2. View the machine operating system parameters of the database
EXEC master.. xp_msver
3. View Database Startup Parameters
sp_configure
4. View Database Startup time
Select CONVERT (varchar, login_time,120) from master. sysprocesses where spid=1
To view the database server name and instance name
print ' Server Name ... ...: ' + CONVERT (varchar (), @ @SE
, that is, SQL Server retains row space according to the column definition size, rather than the actual characters in the character. For example, if a column is defined as CHAR (25), SQL Server reserves 25 characters in the row regardless of the length of the stored string.
The data type (VARCHAR and NVARCHAR) containi
SQL Server can specify collations in instances, databases, columns, and queries, respectively/*Module 1-working with Clollations*/--1.1 Obtain the Instance Collation from the GUI--Create a Database without specifying a specific CollationCreate Databaseunspecifiedcollationdb;GO--Use the statement bellow (code) to Verfiy, the new database inherited the Collation Useunspecifiedcollationdb;GOSelect db_name() as
row overflow, and how does the storage engine handle them? If reproduced, please indicate the source of the blog: www.cnblogs.com/xinysu/, copyright belongs to the blog Garden su Home radish all. Hope you support! Previous post in this series link: SQL Server big Talk Storage structure (2) _ Nonclustered index how to find Row Records back top (go to top) 1 introduced in a DB, each table can find the corre
allocation unit ID of the object that owns the page.
On the data page, data rows are placed in sequence followed by headers. The end of the page is a row offset table. For each row on the page, each row Offset Table contains an entry. The distance between the first byte of the corresponding row and the header of each entry record. The order of entries in the row
If you carefully track the login process of the SQL Server database server, you will find that password computing is actually very fragile. The weak password of the SQL Server database reflects two aspects:
1. Password Encryption during network login
Algorithm
2. Pass
SQL Server transaction backup and restoration instance code (mandatory), SQL Server transaction
Let's just talk about the code.
Create database mydbuse mydbgocreate table account (id varchar (16), name varchar (16), balance float) goselect * from accountinsert into account (id, name, balance) values ('000000', 'liyun',
will be upgraded with the Database Upgrade. This upgrade will prevent the database of the updated version from being restored or attached to the previous database, because instances of the previous version cannot understand the version of the new database version. For more information, see A blog: Search Engine Q A #13: Difference between database version and database compatibility level. if you attach a new database to an instance of the old version, the following error occurs: Msg 602, Level
one byte, but one occupies KB of storage space and the other occupies KB of storage space, double the value of another table !!!
The gap between one byte leads to a doubling of the storage space. Why? This should begin with the SQL Server storage structure.
---------------------------------------------- The gorgeous split line. Enter the topic ---------------------------------------------------------------
by one byte, but one occupies KB of storage space and the other occupies KB of storage space, double the value of another table !!!
The gap between one byte leads to a doubling of the storage space. Why? This should begin with the SQL server storage structure.
---------------------------------------------- The gorgeous split line. Enter the topic --------------------------------------------------------
sys. allocation_units as a ON a. container_id = p. partition_id
Where I. object_id = OBJECT_ID ('tb4039') OR I. object_id = OBJECT_ID ('tb404040 ')
System return result:
TableName DataSizeTb4039 400Tb4040 800
Similar to the results we can see through reports or SSMS, the two tables only differ by one byte, but one occupies KB of storage space and the other occupies KB of storage space, double the value of another table !!!
The gap between one byte leads to a doubling of the storage space. Why?
modified is found, the X lock on the resource being modified is required. SQL Server avoids deadlock problems with u locks. Because S-Lock and S-Lock are compatible, the U-Lock and S-lock are compatible to make the update lookup not affect the data lookup, and the U-Lock and U-Lock are not compatible, thus reducing the possibility of deadlock.
Intent Lock (is IX IU): Intent Lock is
. How to analyze SQL Server SQL statements:Set statistics time {on | off}Set statistics io {on | off}Display query execution plan in graphical modeIn the query analyzer-> query-> display estimated evaluation plan (D)-Ctrl-L or click the graph in the toolbarDisplay query execution plan in text modeSet showplan_all {on | off}Set showplan_text {on | off}Set statisti
rows, row density,QueryConditions. However, the specific judgment condition is that Microsoft has not published a secret. Developers do not have to worry about how SQL Server decides which lock to use. Because SQL Server has made the best choice.
In
the data, take the data in a certain way, and finally close the connection, and in SQL Server, T is just the definition of how to get the required data, without regard to implementation details. Figure 1 goes through several steps from T-SQL to specific return data, and there are a number of rules for each step. Therefore, the performance problems caused by wher
Current version: Windows Server R2 SP1 + SQL Server (RTM)Sp_replqueuemonitorThis stored procedure lists queue messages for queued updating subscriptions for a MicrosoftSQL Server queue or for a specified publication in Microsoft Message Queuing.(in the subscription database, view the command that the queue is executing
the next few pages of SQL can be similar:SQL code
SELECT * from articles WHERE category_id = 123 ORDER by ID LIMIT 10000,
Word, the more backward the page, the offset of the limit statement will be greater, the speed will be significantly slower.At this point, we can improve paging efficiency by sub-query, roughly as follows:SQL code
SELECT * from articles WHERE ID >=
(SELECT
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.