Yesterday's SQL Server query performance optimization-index creation principle (I) mainly introduced the principle. today are some of the main principles and checks the created indexes.
Iii. indexing principles
In general, building indexes depends on the data usage scenarios. In other words, which SQL statements are co
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
35. use SQL query analyzer and SQL profilerUse SQL query AnalyzerUse SQL profilerOptimize T-SQL statementSummaryIn this chapter, we will continue with the description of the pre-stored
partial database backup and file backup. The new restore statement allows you to use full or partial database backup and record file backup for restoration. These replace the dump and load statements in earlier versions of SQL Server. For a complete list of new statements and options for SQL Server 7.0 and
--
Script used to obtain the connection information of the SQL Server server (based on the original shard creation and writing)
Declare@ Dbname sysname,-- The name of the database to be queried (empty for all). The connection information of all databases is queried by default.@ Brief deip bit-- Whether to display the IP address (0 NO, 1 Yes). This control is add
After sqlserver2005, MSSQL began to use the recursive query method. Compare the methods for writing stored procedures or functions at the beginning. This method is simpler and more flexible.
Oracle also has its own tree structure recursive query method, connect
Next I will write a piece of SQL code by myself, and briefly comment out some usage of the CTE shar
Label:Original: SQL Server 2012:SQL Server architecture--The life cycle of a query (part 1th)To reduce the scope of the read operation, this article first looks at a simple select query and then introduces additional procedures re
SQL statement to query the SQL Server name and IP address, SQL Server
Get Server Name:
SELECT SERVERPROPERTY('MachineName')select @@SERVERNAMEselect HOST_NAME()
To obtain the IP addres
SQL statement to query the memory usage of SQL Server, SQL Server
SELECT type, -- Clerk type sum (bytes) as vm_Reserved_kb, -- reserved memory sum (bytes) as vm_Committed_kb, -- Submitted memory sum (awe_allocated_kb) as awe_Alloc
Original: SQL Server 2012:SQL Server architecture--The life cycle of a query (part 2nd)Planning cache (Plan caches)If SQL Server has found a good way to execute a piece of code, it shou
) Select DATEADD (Wk,datediff (Wk,0,getdate ()), 0) query yesterday Date: Select CONVERT (Char,dateadd (dd,-1,getdate)), 111 //111 is the style number, (100-114) query the first day of the month Date: Select DATEADD (mm, DATEDIFF (Mm,0,getdate ()), 0) as FirstDay query last day of the month Date: Select DATEADD (M S,-3,dateadd (mm, DATEDIFF (M,0,getdate ()) +1, 0
SQL Server paging query processing method summary, SQL Server Paging
Sqlserver2008 does not support the keyword limit, so its paging SQL query statement cannot be performed using MySQL.
Date formatting statement and SQL Server statement during SQL Server Query
The default datetime format of the Chinese version of SQL Server isyyyy-mm-dd Thh:mm:ss.mmm
For example:
sele
SQL Server uses the tree structure recursive query (infinitus classification) method. SQL server uses the Tree Structure
Starting from SQL Server 2005, we can use CTE to support recursi
SQL Server quickly generates SQL addition, deletion, modification, and query statements, and SQL addition and DeletionAre you still coding to generate SQL statements? Are you still speechless for
SQL Server tree query single table instance code, SQL Server single table
-- TREE SQL query WITH TREE AS (-- create a virtual table SELECT * FROM sys_organiz -- specify the table to be
Query a stored procedure sharing of SQL Server database deadlocks. SQL Server Stored Procedure
When SQL Server is used as the database application system, it cannot avoid deadlocks. Whe
Tags: SQL statement electronic win style SPAN different statement column DTS --Connect remote SQL or insert data with OPENROWSET
--if only temporary access, you can directly use OPENROWSET
--Query Example
Select * from OpenRowset('SQLOLEDB'
,'SQL Server name';'User name
find books, we generally use the way (the definition of parameters and data collection on the Assignment simulation page): 1 DECLARE @publishers VARCHAR (a);
2 SET @publishers = ' Tsinghua University Press ' ;
3 SELECT * from WHERE Publishers=@publishers The results are as follows: When the publisher filter condition is NULL, how do you write SQL? 1 DECLARE @publishers VARCHAR (a);
2 SELECT * from WHERE Publishers=ISNULL(@publishers, Publishers
Source: http://www.cnblogs.com/doosmile/archive/2012/03/16/2400646.html--Connect remote SQL or insert data with OPENROWSET--if it's just temporary access, you can use OPENROWSET directly--query ExampleSELECT * FROM OPENROWSET (' SQLOLEDB ', ' SQL Server name '; ' User name '; ' Password, database name. dbo. Table name)
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.