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