SQL Server common SQL Summary
Order by NAME collate Chinese_PRC_Stroke_CS_AS_KS_WS
/* Sqlserver grouping cannot use text, ntext, or image fields as the grouping basis */
-- Use index for mandatory query:
Select id from table_name with (index name)
Data operations between databases on different servers
-- Create a linked server
Exec sp_addrole server 'itsv', '', 'sqloledb', 'remote server name or IP address'
Exec sp_add1_srvlogin 'itsv', 'false', null, 'username', 'Password'
-- Query
How to copy SQL Server tables and EXCEL Data in batches (solved)
1. Copy SQL Server table data to excel (method)
1. Create a New query and read the table data using SQL statements.
2. Then, right-click the data and copy it (you can also click
Wildcard
The wildcard character in SQL is used to replace one or more characters.
Use the SQL wildcard with the LIKE operator.
Common wildcards in SQL Server
%
Match any length (the length can be 0) characters
For example,'m % n' matches any
Original information
Database Unit Test Tool-SQLUnit
Preface
As mentioned before, I have changed the original code writing method. Instead of writing test cases immediately (I know this development theory is hard to stand ). But when I predict that
1. CONVERT () function
?
1
CONVERT (data_type (length), data_to_be_converted, style)
Data_type (length) specifies the target data type (with an optional length ). Data_to_be_converted contains the value to be converted.
Summary of the SQL Server View
A view is stored on a physical table. It is changed due to changes to the physical table and generally does not need to be updated.
View as a filter: It can be seen from the Filter Name that the main purpose of such
Mom was called by the boss recently to get sqlserver
Well, it's easy. Just change the configuration of hibernate.
Get the driver package for half a day or something
It's okay to use the SQL Server client to connect to the database. (The connection
Let's take a look at a table: how can we easily add data to this table in the database SQLServer?
It is not difficult to observe this table carefully. The addition of the column data in the ID field is regular, and it is an ascending sequence of
I tried it myself today. $ in ibatis is so dangerous. If you use $, it is likely to be injected with SQL !!!
Therefore:
Use: select * from t_user where name like '%' | # name # | '%'
Disable: select * from t_user where name like '%' | '$ name $' |
Read awr and find that an SQL statement is executed for more than 40 seconds at a time. The statement is as follows:?
1
SELECT. bill_class AS pol_code, B. bill_name AS pol_name,. bill_no AS card_no, 'website' AS buy_path,.
An SQL statement is:
Select * from user where gender = '1' order by id desc;
Indexing method:
1: add an index for gender
2: add an index for the id
3: Add a joint index for id and gender
Facts prove
1 is correct. With the gender Index, the
Introduction: We recently found a highly cost-effective SQL statement. When creating a primary key, it sometimes fails because the selected primary key column contains duplicate data, in this way, the primary key cannot be successfully created. At
The SQL statement is called to restore the backup of SqlServer, including full backup and differential backup. The CommandTimeout parameter must be set because it takes some time to restore the backup.
///
/// Call the SQL statement to back up the
The process control commands used by the Transact-SQL language are similar to the common programming languages, which mainly include the following control commands.
4.6.1 IF... ELSE
The syntax is as follows:
IF
[ELSE [conditional expression]
]
The
Because I got my own Q & A app www.sosoask.com in the past two days, I found that the developer encrypted my stored procedure and was depressed. I am glad to find a solution. Now I share it with you:
Open the query analyzer, locate your database,
Suppose a host has opened port 1433, and we have used SQL injection or a weak password for remote connection.
How can I add a system administrator user (or execute system commands)
1). xp_{shell 'cmd.exe/c net user aaa bbb/add'
The biggest benefit
Logs are generated for each query in SQL, but if you do not clean up for a long time, the whole hardware may be full. In this case, I cannot directly enter the website background. Next, let's take a look at how to clear this log.
SQL2005 clear
Pg_stat_statements is an extension module of postgresql. It mainly records the running information of SQL statements. This module must add shared_preload_libraries to postgresql. conf, and the database needs to be restarted. download the source code
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.