the database user associated with the SQL Server login.Tips:As with a staircase of level 1, if you want to run these code samples in a local instance of the SQL Server, you may need to make some changes to the code example. The code in Listing 2.2 assumes that you have a adventureworks2012 database installation. The f
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
: Server.Database.Schema.Table in the current database does not require the server and database name, that is, in general we need some of the latter two parts. There are two advantages to using qualified names, ① avoid accidental errors, ② improve the performance of queries, so it is recommended to develop good habits. Where Condition Filters the output from the FROM clause and restricts the rows returned in the result set. Comparison operator Standa
server must be on the same physical computer.
Because it can bypass the physical network stack, the shared memory Net-Library is much faster than other Net-libraries. Access to the shared memory area is protected by synchronization objects. Therefore, the communication speed between the client and the server is mainly limited by Windows's ability to schedule kernel objects, and the ability to replicate dat
Http://blog.chinaunix.net/u2/65729/showart_1728182.html Data accessing other remote databases in ms SQL Server can be achieved through the openquery (TRANSACT-SQL) function. First, create a linked server and maintain remote data like normal tables. How to Create a ms
name, export all user tables for the database
, @filename varchar (1000)--import/Export the path/file name, if the @tbname parameter indicates that the entire database is exported, this parameter is the file store path, the file name automatically with the table name. txt
, @isout bit--1 for export, 0 for import
As
DECLARE @sql varchar (8000)
If @tbname like '%.%.% '--If a table name is specified, export
Server Database SQL statement Import and Export Daquan, including the import and export of data with other databases and files.
/****** Export to excelExec master.. xp_mongoshell 'bcp settledb. DBO. shanghu out c: \ temp1.xls-C-Q-s "gnetdata/gnetdata"-U "sa"-P ""'
/*********** Import ExcelSelect *From OpenDataSource ('Microsoft. Jet. oledb.4.0 ','Data source = "C: \ test.xls"; user id = admin; Password =; e
stress treatment measures, often results will be unsatisfactory. Think like Query OptimizerIn every field there are rules in their domain, and most simply, if you do not conform to the C # specification for programming, such as using keywords incorrectly, then the compilation will be an error. Of course, there will be some hidden rules in each area, and some people will say is the so-called "unspoken rules", such rules are often not materializing, su
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 server
. table Name, all user tables of the database are exported , @ filename varchar (1000) -- import/export path/export , @ isout bit -- 1 is exported, 0: Import as declare @ SQL varchar (8000)
If @ tbname like '%. %. % '-- if the table name is specified, export a single table begin set @ SQL = 'bcp' + @ tbname + case when @ isout = 1 then 'out' else 'in' end
) -- import/export path/file name. If @ tbnameverification indicates that the entire data warehouse is exported, the file name will automatically use table name .txt, @ Isout bit -- 1 is for export, 0 is for ImportAsDeclare @ SQL varchar (8000)
If @ tbname like '%. %. %' -- if the table name is specified, a single table is exported directly.BeginSet @ SQL = 'bcp'
compare, while A>=3 SQL can find the record index of =3 directly. Can be considered together with a nonclustered index.8. Like operatorThe LIKE operator can apply a wildcard query, where the wildcard combination may reach almost arbitrary queries, but if used poorly it can
Server
1.1. SQL Server development process
SQL Server is a relational database management system for Microsoft Company, but it has to start with Sybase in terms of its history. SQL Server
about remote view is that it's easy to bind to the Visual FoxPro built-in controls. Each remote view is an object stored in the Visual FoxPro database Container (DBC), which is a sql-select statement. Remote views communicate with heterogeneous databases through ODBC (Open database Connectivity).
Although the example in this article uses SQL Server as the back-
operationDetermining whether a field is empty generally does not apply an index because the index does not index null values. You cannot use NULL as an index, and any column that contains null values will not be included in the index. This means that if a column has a null value, even indexing the column does not improve performance. Any statement optimizer that uses is null or is not NULL in the WHERE clause does not allow the use of indexes.Recommended scenario: Replace with other operations
characters in the searched string before and after "bc!If you want to know whether the searched string starts with a specific string, you can skip the % mark. Write the patinded function as follows:Patindex (AB %, abcd)The result of executing this command returns 1, indicating that the searched string "AB" is found in the searched string "abcd.You can use wildcards to edit search strings that are much more complex than the preceding simple example. If you want to determine whether a string cont
not correct. You cannot or do this. It's easy for your users to browseOnly 100000 records can find the desired record. He will curse you. Here, you need a better UI, and you need to display up to 100 or 200 records for your users.10. Do not use server-side cursorsCompared with server-side cursors, client cursors can reduce the system overhead of servers and networks and reduce the lock time.11. query using
[Deptno] in (SELECT [Deptno] from [dept] where [loc]= ' Melb '); 4, is null or NOT NULL operation Determining whether a field is empty generally does not apply an index because the index does not index null values. You cannot use NULL as an index, and any column that contains null values will not be included in the index. This means that if a column has a null value, even indexing the column does not improve performance. Any statement optimizer that uses is null or is not NULL in the WHERE clau
data.
non-repeatable reads : Reads the same data multiple times within a single thing. When this transaction is not finished, another thing is accessing the same data, and the first transaction two reads from the first transaction two reads, because of the modification of the second transaction, the data may be different. This occurs when the data that is read two times within a transaction is different, so it is called non-repeatable read.
Phantom reading : a phenomenon that occurs whe
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.