Small knowledge reserves, small financial management knowledge

Source: Internet
Author: User

Small knowledge reserves, small financial management knowledge
With nolock

WITH (NOLOCK) is equivalent to the uncommitted read (read uncommitted), which means that the specified statement can READ the rows that have not been committed by other transaction modification tickets and run transactions at the uncommitted read level, no shared lock will be issued to prevent other transactions from modifying the data read by the current transaction, and will not be blocked by the exclusive lock, so WITH (NOLOCK) it can improve the query efficiency by improving the data set LOCK phenomenon in a large online query environment;

SELECT COUNT(UserID) FROM EMPLOYEE WITH (NOLOCK) JOIN WORKING_GROUP WITH (NOLOCK) ON EMPLOYEE.UserID = WORKING_GROUP.UserID
String and StringBuilder

The String object cannot be changed. Every time you use a method in the System. String class, you must create a new String object in the memory, which requires a new space for the new object. If you need to modify the String repeatedly, the system overhead associated with creating a new String object may be very expensive.

If you want to modify the string without creating a new object, you can use the System. Text. StringBuilder class. For example, when many strings are connected together in a loop, the StringBuilder class can improve the performance. When the StringBuilder class is modified, it will not re-allocate space for itself until the capacity is reached. When the capacity is reached, a new space is automatically allocated and the capacity is doubled.

The Length attribute of StringBuilder is not read-only,

If you set the Length attribute to a value greater than the Capacity attribute, the Capacity attribute is automatically changed to the same value as the Length attribute. If you set the Length attribute to a value smaller than the string Length in the current StringBuilder object, the string is shortened.

T-SQL Batch Processing

A batch is a T-SQL statement that acts as a logical unit. If a statement cannot be analyzed by syntax, no statement is run. If a statement fails during running, all the statements before the wrong statement is generated have been run.

Batch Processing is often used in scripts that have to be prefixed or separated from other tasks. (generally, only one ddl statement can be submitted in the same batch)

USE Test  ALTER TABLE TestTable      ADD col3 int  INSERT INTO TestTable      (col1,col2,col3)  VALUES      (1,1,1)

The above code prompts in the query analyzer that the col3 column does not exist. Solve the problem through a go

USE Test  ALTER TABLE TestTable      ADD col3 int  GO   INSERT INTO TestTable      (col1,col2,col3)  VALUES      (1,1,1)
JavaScript injection attacks

Reference

 

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.