In SQL Server, you can call the command line tool bcp under DOS to generate text files for the data or SQL statement results in the table.BCP command parameter format:Copy codeThe Code is as follows:BCP {dbtable | query} {in | out | queryout | format} datafile[-M maxerrors] [-f formatfile] [-e errfile][-F firstrow] [-L
SQL Server that extracts previous or previous percentage data. Through the application of the author in practice, it is found that top is very useful, and the efficiency is very high. But this word is not in another large database Oracle, which is not a pity, although it can be solved in Oracle with other methods (such as: RowNumber). In a later discussion about
disperse the concurrency pressure of the large scale data, also can speed up the speed of special query, the redundant field can reduce the connection of database table effectively and improve the efficiency.3.Design of the primary keyThe primary key is necessary, and the primary key for SQL Server is a unique index, and in practice, we tend to choose the smallest key group to work as the primary key, so t
through SQLCMD, holtestdb the data in the table named people, with IDs greater than 13. Then this command is:Sqlcmd-u xxxxx-p xxxxxx-s xxxxx-d holtestdb-q "Delete from people where ID > 13"-S: Server DNS name. You can find it through the management portal, such asIn fact, we mainly remember the following format is possible: We will be in the back of the two real columnsSqlcmd-u User name-p password-s
The following SQL statement passed the test in Access XP Query
Table creation:
Create Table tab1 (
Id counter,
Name string,
Age integer,
[Date] datetime );
TIPS:
Use counter to declare the auto-increment field.
Fields with field names as keywords are enclosed in square brackets []. It is also feasible to use numbers as field names.
Index creation:The following statement creates a repeatable index on the date column of tab1Create index idate on
are generally stored as disk arrays.
C Disk Operating System File
Data Files and transaction log files and Tempdb data files and Tempdb log files on disk D
Store the backup files in the database on the edisk
When formatting a disk, do not use the disk to store SQL server data files and log files.Default disk allocation Unit
Use64 k cluster size Allocation UnitTo f
Serve authentication (enter the database user name and password)->Database (you can select a database with all permissions on the SQL Server server selected above)-> next-> Select purpose-> purpose (Text File)-> file name (generate a custom text file on your computer's hard drive)-> next-> Create a table copy or query-> copy the table and view from the source
setting is complete, click the OK button to restore the database and a message dialog box appears after the restore succeeds, asking the user to confirm that the restore completed successfully.Restore operations for differential backups, log backups, file and filegroup backups are similar to the restore operation of a full database backup.2. Recovering a database using Transact-SQL statement restoreIn contrast to the BACKUP statement, the RESTORE sta
This article is part of the "Building a client/server application with Visual FoxPro and SQL Server" series, as the usual "remote view" should not be the opening chapter, but we found that there are too many theoretical things in the articles we prepare for the site, in order to mitigate this contradiction, We decided to write "Remote View" first.
Today's most p
form:string connectionString [email protected] "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\datasource\myschool.mdb" ;Description: In program code, a database connection is implemented through an OLE DB provider specifically for an Access database. This uses the OLE DB provider as microsoft.jet.oledb.4.0, and the database is stored in the C:\DataSource directory with a database file of Myschool.mdb.[CSharp]View Plaincopy
stringConstr ="server
First, the preface
SQL Server 2005 introduces a native data type called XML. Users can create tables that have one or more XML-type columns in addition to the relational column, and also allow variables and parameters. To better support XML model features such as document order and recursive structure, XML values are stored as large binary objects (BLOBs) in an internal
time, but cannot be updated (the standby database is read-only ).
First, create a database for demonstration (master database)
Create database Db_test
ON
(NAME = Db_test_DATA,
FILENAME = c: \ Db_test.mdf)
LOG ON
(NAME = Db_test_LOG,
FILENAME = c: \ Db_test.ldf)
GO
Back up databases
Backup database Db_test to disk = c: \ test_data.bak WITH FORMAT
GO
Restore the database to a backup database (this shows the synchronization between the primary databa
Label:In the database server, memory is one of the most important resources for the database to provide services to the outside, Not just SQL Server, including other databases, such as Oracle,mysql, is a kind of memory-like application. In a SQL Server
. The FULLSCAN clause specifies that all data in the table is scanned to collect statistics, while the sample clause is used to specify the percentage of rows sampled or the number of rows sampledIn SQL Server 2005, the database Options Auto_update_statistics_async provides statistical information for the asynchronous Update feature. When this option is set to ON
view, SQL Server does a full table scan of table orders and should be inefficient. Take a look at the following query:As you can see from this execution plan, it's not the same as the one above. The lookup of the Orders table in the previous query was using the "Clustered Index Scan" method, and now the "Clustered Index Seek" method was used, and the percentage
This forum article (The Sadie Network Technology community) describes how SQL Server uses format string customization dates to convert to strings, for more information, see below:
DateTime.ToString ("Yyyy-mm-dd") is used in C #, and DateTime.ToString ("mm/dd/yyyy") is a way to convert dates and strings that are not available in
Options command parameter to let SQL Server display all the options. To enable show advanced options, we use the following command format:
EXEC sp_configure ' show advanced options ', ' 1 ' reconfigure
To install an option, we must run the reconfigure command after using sp_configure to configure the server. The outpu
source database (you can also select a query item to specify the data to be transmitted) -> next-> select the target file format-> source (select the table to be exported) -> use the default delimiter-> select the option that contains the column name in the first package-> next-> Save, schedule, and copy the package-> time-> run immediately (if you want to implement a time interval automatically export to a text file, select the scheduling DTS packag
After watching the garden vallen introduction SQL Prompt blog Red Gate Series three SQL Server development tool SQL Prompt 5.3.4.1 Edition T-SQL IntelliSense Analyzer complete hack + Use tutorial, combine your own use to do some supplemental memo.Solve the problem
Resol
that use exists.4, in the vast number of queries as far as possible to use the format conversion.5, when in Server 2000, if the stored procedure has only one parameter and the output type, you must give this parameter an initial value when calling this stored procedure, otherwise the call error will occur.Basic principles of SQL
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.