But by default, if not filtered, the lock information captured by the profiler contains locks inside SQL Server, which is very inconvenient for us to view the lock information, so we often need to filter the columns as shown in 6. Figure 6: Filtering out the database lock information The captured information is shown in 7. Figure 7. Information captured by the profiler the size of the lock The lock is
machine firstALTER DATABASE [@error_database_name] set Single_userFix tables with inconsistent errorsDBCC CHECKTABLE (' @error_table_name ', Repair_allow_data_loss)Or, unfortunately, choose to fix small database names with inconsistent errorsDBCC CHECKDB (' @error_database_name ', Repair_allow_data_loss)ALTER DATABASE [@error_database_name] set Multi_userThe CHECKDB has 3 parameters:Repair_allow_data_loss includes assigning and reassigning rows and p
1. view the database versionSelect @ version
Common SQL server patch versions:
8.00.194 Microsoft SQL Server 20008.00.384 Microsoft SQL Server 2000 sp18.00.532 Microsoft SQL
are displayed on the data page as follows:
If I insert the following data into it:
Insert IntoTest (rowid, column1)Select 7,' '
Because the rowid column of this table has a clustered index (primary key creates a clustered index by default), and the number 7 is about 2 and less than 10, then when SQL Server performs the insert operation, will rowid = 10 be moved down? Obviously,
For the first time, SQL Server appeared on the top ten rankings of "all environments" (This ranking includes all databases running in Microsoft Windows and non-Windows environments ), this indicates that SQL Server has ranked among the OLTP databases with the largest number of rows
SQL Server trigger and SQL Server triggerSQL Server triggers
A trigger is a special type of stored procedure, which is different from the stored procedure we introduced earlier. A trigger is triggered by an event and automatically called for execution. The stored procedure c
server| Data | database | Statement SQL SERVER Database Management Common SQL and T-SQL statements
1. View the version of the database
SELECT @ @version
2. View the machine operating system parameters of the databaseEXEC master.. xp_msver
3. View Database Startup Parame
SQL Server synchronous replication troubleshooting method, SQL Server
1. the row cannot be found on the subscription server when the command copied by the application is run.
Solution: Use System stored proceduresSp_browsereplcmds(Return the result set of the readable ve
the data object
Partition_number
Partition code
Rows
Approximate number of rows of data
hobt_id
Storage unit ID of the heap or B-tree where the data is stored
Let's find a database to look at the fragmentation situation:You can see that the arrows refer to this row of data, the theory should be a zone on it, but in fact it establishes two pa
Operator: indicates failure ann A full operator that, if the message cannot reach the specified operator for an indeterminate reason, the SQL Server Agent passes the message to the failed-safe operator;
(5) Select the Job System tab, as shown in Figure 17-4;
Job History log: This area specifies the size of the log and the maximum number of rows per piece o
+ BEGIN
- PRINT 'the values for the current @id are:'+CONVERT(NVARCHAR( -),@ID)
+ END
A PRINT 'assigns a value of 0 to @id'
at --assigns a non-null value to the @id and outputs
- SET @ID = 0
- PRINT 'the values for the current @id are:'+CONVERT(NVARCHAR( -),@ID)
- GO Sample Code The first output @ID start the
first output @ID finished the
second output @ID start
current @ The value of the ID is: the
second output @ID complete
(1
.. sysdatabases d Where sid not in (select Sid from Master .. syslogins where name = 'sa ')OrSelect dbid, name as db_name from Master .. sysdatabases where Sid
14: query the fields and Data Types of a tableSelect column_name, data_type from information_schema.columnsWhere table_name = 'table name'
[N]. [title]:Select * From tablename order by customername
[N]. [title]:Select * From tablename order by customername
1. view the database versionSelect @ version
2. view the operating sy
is 0;m_flagbits for page properties, such as 0x200 indicates that the page has checksum check; M_prevpage and m_ NextPage, the data pages of the same level in the B-tree structure are connected to each other through m_prevpage and m_nextpage; m_slotcnt indicates how many records are in the current page; m_freecnt indicates how much space is left in the current page, in bytes. M_LSN indicates that the last change in all records in the current page corresponds to the log record number. The data s
Tags: http use strong data AR problem working timeRegardless of the database, if you want to optimize the performance of the database, you must understand the storage structure inside the database. Otherwise, a lot of database optimization work can not be expanded. For the database administrator, although the memory storage structure of the learning database is rather monotonous, it is a fortress that we must attack. In a SQL
SQL Server database optimization practice (III), SQL Server
Preface:
This chapter describes how to compress logs and tables.
Shrink log files
-- Exploitation
Exec sp_spaceused
Statement to view the database size
-- Right-click Database Properties
-- View options
-- Set the recovery mode to simple
-- Right-click D
], [t0]. [UnitsInStock], [t0]. [UnitsOnOrder], [t0]. [ReorderLevel], [t0]. [Discontinued] from [dbo]. [Products] As [t0] ) as [t1]where [T1]. [Row_number] Between @p0 + 1 and @p0 + @p1ORDER by [T1]. [Row_number] ', N ' @p0 int, @p1 int ', @p0 = n, @p1 = 10This is exactly what we used to write the Row_number-based paging program. It can be seen that the simple word skip and take,linq in the back to help us do a lot of work.Paging using the offset
file. Data files contain data and objects, such as tables, indexes, stored procedures, and views. The log file contains the information required to recover all the transactions in the database. For ease of allocation and management, data files can be assembled and placed into filegroups. The basic unit of data storage in SQL Server is called a page. Each page is 8kb,sq
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 (), @
February 6, 2008 by pinaldave
This is very common request recently-how to import CSV file into SQL server? How to load CSV file into SQL Server database table? How to load comma delimited file into SQL server? Let us see the solu
, retrieve the data in a certain way, and finally close the connection. In SQL Server, t-SQL only defines how to get the data you need without considering implementation details.As shown in Figure 1, from the T-SQL to the specific returned data goes through multiple steps, each step has a large number of rules. Therefo
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.