Category: SQL Server

Using Partitioned Views

The partitioned view allows you to split the data in a large table into smaller member tables. According to a range of data values, the data to be partitioned between the member tables. The range of data for each member of the table are defined in a CHECK constraint specified for partitioning column. Then define a view that […]

The SQL SERVER critical system table

The sysobjects table created for each object in the database (constraint, default, log, rule, stored procedures, etc.) in the table per line. Only in tempdb, each temporary object one row in the table. Column name Data type Description name sysname object name. Id int object identification number. xtype char (2) object type. Can be in one of […]

DBCC command

Transact-SQL programming language provides DBCC statements as Microsoft ® SQL Server ™ 2000 database console commands. These statements are physical and logical consistency of the database to be checked. Many DBCC statements can fix the problems detected. Database Console Commands statement is divided into the following categories. Statement classified perform the maintenance statement to the database, index […]

Different backup name of the SQL database to store different path reduction method

Different backup name of the SQL database to store different path to restore the collection / * ————————————- ——————————- Author: htl258 (Tony) – Date: 2010-04-15 22:07: 01 – Version: Microsoft SQL Server 2008 (RTM) – 10.0.1600.22 (Intel X86) Jul 9 2008 14:43:34 Copyright (c) 1988-2008 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: […]

Worthy collection of Microsoft SQL Server SQL statement

Worthy collection of Microsoft SQL Server SQL statement 2007-11-07 16:04:00 Tags: the SQL basic skills operating statement [pushed to the technology circle] SQL statement previously written, it is easy to forget some special usage, I hereby order the operation of the SQL statement. First, the basic instructions: Create a database CREATE DATABASE database-name Description: delete the […]


Use CONVERT: CONVERT (data_type [(length)], expression [, style]) SELECT CONVERT (varchar, getdate (), 120) 2004-09-12 11:06:08 select replace (replace (replace (CONVERT (varchar, getdate (), 120), / ‘- /’, / ‘/’), / ‘/’, / ‘/’), / ‘:/’, / ‘/ ‘) 20040912110608 SELECT CONVERT (varchar (12), getdate (), 111) 2004/09/12 SELECT CONVERT (varchar (12), getdate (), 112) […]

BULK INSERT large quantities of data

BULK INSERT [[‘database_name’.] [‘Owner’].] {‘Table_name’ FROM ‘data_file’} [WITH ([BATCHSIZE [= batch_size]] [[,] CHECK_CONSTRAINTS] [[,] CODEPAGE [= ‘ACP’ | ‘OEM’ | ‘RAW’ | ‘code_page’]] [[,] DATAFILETYPE [= {‘char ‘|’ native ‘|’ widechar ‘|’ widenative ‘}]] [[,] FIELDTERMINATOR [=’ field_terminator ‘]] [[,] FIRSTROW [= first_row]] [[,] FIRE_TRIGGERS] [[,] FORMATFILE = ‘format_file_path’] [[,] KEEPIDENTITY] [[,] KEEPNULLS] [[,] KILOBYTES_PER_BATCH […]

Reuse of the data table space (Reusing space in a table)

If you delete some rows of data, I need to compress the SQL Server database? For these spaces can be re-used, which is a very good question, the cut is often asked, which relates to the management of the SQL Server database to delete and compression mechanism. 1 understand how SQL Server automatically re-use of […]

Vista the sql2005 Additional database failure problem

Vista install SQL Server 2005/2008, the additional database error solution I installed SQL Server 2005 in Vista, detach the database, for additional following error occurred: Prompt “Unable to open the physical file ………… operating system error 5:” 5 (Access Denied) “(Microsoft SQL Server, Error: 5120) Online are said the problem is caused due to the […]

Table structure information inquiry

– Sql server 2005 – 1 table structure information inquiry – ================================================ ======================== – Table structure information inquiry – Zou 2005.08 (reference please retain this information) – ================================================ ======================== SELECT TableName = CASE WHEN C.column_id = 1 THEN ELSE N” END, TableDesc = ISNULL (CASE WHEN C.column_id = 1 THEN PTB. [Value] END, N”), […]