Substring function is used for SQL Server operations.
Substring (expression, start, length)
ParametersExpressionString, binary string, text, image, column, or expression that contains a column. Do not use expressions that contain aggregate
Figure 1 wins the 10 Statement: SQL Server database Summary
A rough summaryAfter a period of study, I also had some knowledge about databases.Databases are basically composed of tables, relationships, and operations. For Beginners, the first thing
In database operations, you will use objectowner when the Database Object List contains more than one common element, objectname. objectname to reference objects, but if you need to change the owner of objects in the current database, you can use
-- Simple Case FunctionCASE sexWHEN '1' THEN 'male'WHEN '2' THEN 'female'ELSE 'others' END-- Case search functionCase when sex = '1' THEN 'male'WHEN sex = '2' THEN 'female'ELSE 'others' END
These two methods can achieve the same function. Simple
The following code creates a table structure:
Copy codeThe Code is as follows: create table test_tb
(
TestId int not null identity (1, 1) primary key,
Caption nvarchar (100) null
);
GO
Solution 1:For this question, the first thought may be: Can I
The first error "SQL Server does not exist or access is denied" is usually the most complicated. There are many causes of the error and there are many aspects to check. Generally, there are several possibilities:
1. the SQL Server name or IP address
Production Environment:
SQL Server 2008 R2 Active/Passive Nodes, Windows Server 2008 R2 SP1 Cluster, vSphere 5.x
Start
6 am received the Application Team report BiztalkMsgBoxDb enters the suspect mode and cannot be accessed.
Report events to reduce
3. Develop applications
1. sort by strokes of the Last Name:
Select * From TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as // From less to more
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 28 29
SQL SERVER DBCC command explanation
I got up at eight o'clock and got it all the time. I don't know much about it. I just put it up first and then slowly modify it.
-- 1 dbcc trraceon DBCC TRACEOFF
-- For database deadlocks, trace flag 1204, 1205,
Developer nightmare-delete Repeated RecordsPresumably, every developer has had a similar experience. When querying or collecting statistics on the database, the query and statistics results may be inaccurate due to repeated records in the table. The
About with cube, with rollup and grouping
View the help document of SQL 2005 to find the specific difference between CUBE and ROLLUP.:
The result set generated by CUBE displays the aggregation of all the combinations of the values in the selected
Database optimization includes the following three parts: Database optimization, database table optimization, and program operation optimization. This article is the second part.Optimization ①: design a standardized table to eliminate data
1. Meaning of WITHThe with as phrase, also known AS subquery factoring, allows you to do a lot of things and define an SQL segment, which will be used by the entire SQL statement. Sometimes, it is to make the SQL statement more readable, or it may
-- Importing data from an Excel file to a SQL database is simple. Use the following statement:/* ===================================================== ===================================== */-- If the table to be imported already existsInsert into
1. Enable the database to support SQL high-speed cache dependencies.2. Enable the table to support SQL high-speed cache dependencies.3. The web. config file of the ASP. NET application contains the SQL connection string.4. Use SQL high-speed cache
Copy codeThe Code is as follows:SET QUOTED_IDENTIFIER ONGOSET ANSI_NULLS ONGOAlter procedure usp_PagingLarge@ TableNames VARCHAR (200), -- table name, which can be multiple tables but cannot be aliases@ PrimaryKey VARCHAR (100), -- primary key,
Now we want to insert data to table B through programming, but in the program, it is not allowed to assign null values to the Int type. If no value is assigned, the default value is 0.To solve this problem, If Else of the stored procedure is used.
In database programming, transactions are frequently used. net platform, transaction processing is very easy to use, but in the stored procedures of SQL Server database, how to use transactions to complete data batch operations?The solution is as
Copy codeThe Code is as follows:ALTER proc [dbo]. [sp_common_paypal_AddInfo](@ Paypalsql varchar (max), -- does not contain the paypalsql statement of the User table@ Paypalusersql varchar (max), -- SQL statement of the paypal User table@ Ebaysql
You can create a process for permanent use, or temporary use in a session (Partial temporary process), or temporary use in all sessions (Global temporary process ).You can also create a stored procedure that runs automatically when Microsoft 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.