Home > other >  WPF essays about the process of database to store notes during the learning
WPF essays about the process of database to store notes during the learning

Time:01-21

Learning about the process of database storage
A certain stage 1, the new stored procedures, write, execute the tip after "command completed successfully" (previously never shut down the current storage process), then finish at some stage or modified, perform again, will be submitted to the database is the name of the stored procedure wrong, as shown in the figure below:

The solution is to make the "CREATE PROCEDURE WD_CommodityName" in the "CREATE" to "ALTER",
Note: an error can not be directly closed after the stored procedure, must be prompt "command completed successfully" to close the current stored procedure, or when you open this stored procedure again, will find that it did not save us at the first hint "command completed successfully" after any changes,
If you want to avoid this error, we at the first hint "command has completed successfully", will close the current storage process, to open the can,
2, the stored PROCEDURE naming conventions consistent with best window name, so that to maintain and modify later when convenient to find the corresponding places (such as login page ALTER PROCEDURE [dbo] [WD_Login]),
3, declare a variable initial value to note: string varchar, char, initial date type datetime value is';
A double value, decimal, such as plastic int the initial value is 0 (such as @ type char (200)=', @ staff_id int=0),
4, the method named habits: the event name (btnLogin_Click) + (Login) functionality (such as registration of the IF (@ type='btnLogin_Click_Login')),
5, a form of ID as the serial number of the statement is ROW_NUMBER () over (order by one unit. The ID column column names) as a serial number,
6, is a form of a column content to space statement is RTRIM (one unit. A list of column names), note: certain fields can't go to space, otherwise it will cause inconsistent properties of fault (for example: date of birth, the registration time, etc.),
7, below the EXISTS in the specified a subquery, detecting the existence of the "line", the EXISTS to check whether the subquery returns at least one row of data, the subquery is actually not return any data, but the return value of True or False,
8, Transaction (Transaction) is the unit of concurrency control, are user defined an operation sequence, these operations, either do or don't do, is an integral unit,
Transaction is actually very simple, the first thing to know the transaction key things:
(1) the BEGIN TRAN started transaction
(2) the COMMIT TRAN to COMMIT the transaction
(3) the ROLLBACK TRAN ROLLBACK transaction

9, @ @ ERROR global variables, used to return some identification code, such as: commit tran return to zero, the rollback tran returns non-zero,
From a database, 10 custom page display content:
Statement: the RTRIM (case WHEN t_site. Stop_no='true' THEN 'enable' ELSE 'deactivate' END) AS stop_no
And statement: RTRIM (case WHEN t_site. Stop_no='true' THEN 'Blue' ELSE 'Red' END) AS color,
Means: when t_site. Stop_no equals true, then the value for the field 'enable' and color to blue, otherwise the value of fields' deactivate 'and color to red,
11, flashbacks sort statements: the ORDER BY the table name. The ID column column name DESC
12, new ID query statement: SELECT @ @ IDENTITY
13, the use of if there is a table in the query and data records in another table; Statement: the WHERE t_staff. Staff_id in (SELECT staff_id FROM t_operators) and t_staff. Operator_no=1
14, the use of the not query in a table and not in another table data record; Statement: the WHERE t_staff. Staff_id not in (SELECT staff_id FROM t_operators) and t_staff. Operator_no=1
15, in the heart of the Sql varchar values' 6 'converted to data type int statement: the WHERE charindex (',' + rtrim (t_modular_operation. Modular_detail_id) + ', ', ', '+ @ PermissionGroup +', ') & gt; 0
  • Related