Here we will talk about the process control of the stored procedure. if else, case, while, there is no for loop here. These are not as good as c, c ++, c # and other languages.
First, let's look at the use of if elseCopy codeThe Code is as
Introduction
On Windows, SQL Server OS is a user-level operating system level used to serve SQL Server. It abstracts some functions of the operating system from the entire SQL Server engine and forms a separate layer to provide services for the
The following describes the Insert statements, but the Select, Update, and Delete statements are the same.Assume that the following table is available:MytabeField 1 username string type (name)Field 2 age numeric type (age)Field 3 birthday
In forums, people often ask such questions.:Why is the result set of the same query sometimes arranged in the desired order, sometimes not, or in the order of SQL2000, to SQL2005/2008?In fact, as long as "order by" is not specified in the statement,
Copy codeThe Code is as follows:-- Configure permissionsEXEC sp_configure 'show advanced options', 1;GORECONFIGURE;GOEXEC sp_configure 'ad Hoc Distributed Queries ', 1;GORECONFIGURE;GO SQL SERVER and EXCEL Data Import and Export1. query Excel Data
1. Create a new data table with the field id. Set the id as the primary key.Copy codeThe Code is as follows:Create table tb (id int, constraint pkid primary key (id ))Create table tb (id int primary key) 2. Create a new data table with the field id.
Many people may mix the Primary Key and clustered index, or think this is the same thing. This concept is very incorrect.A primary key is a constraint attached to an index. This index can be a clustered index or a non-clustered index.Therefore, if a
Misunderstanding #7: A database may have multiple imagesErrorThis misunderstanding is quite common. Each primary server only supports one backup storage. If you want to have copies of multiple master servers, use transaction log transmission.
This series of articles has never touched on the "Restore" topic, because once this topic is involved, it will involve a lot of misunderstandings, it's as long as I can't finish using an article.In fact, I want to number every misunderstanding in
Processer:% Processor Time Processor is busy with task execution Time threshold 80%, CPU bottlenecks, insufficient memory, low query plan reuse rate, unoptimized statements, and so on.SQLServer: Buffer ManagerBuffer cache hit ratio Adjust the
MongoDB has been in use for a long time, And MongoDB-based data storage has never been used for permission access (MongoDB is set to have no permission access restrictions by default). Today I have spent some time studying it, the research results
-- View the foreign key constraints of a specified tableSelect * from sysobjects where parent_obj in (Select id from sysobjects where name = 'table name ')And xtype = 'pk'-- View All TablesSelect * from sysobjects where xtype = 'pk'-- Delete
1. Create a database
Start the command line and run the following command to open the Shell mode CLP:
Sqlite3 test. db
Although we provide the database name, if the database does not exist, SQLite does not actually create the database until it
SQL UNION operatorThe UNION operator is used to merge the result sets of two or more SELECT statements.Note::1. SELECT statements within UNION must have the same number of columns. Columns must also have similar data types. In addition, the columns
SQL defines variables as the Table TypeWhen defining variables in SQL statements, we often define variables like char, varchar, nvarchar, int ........, so how to make a variable as a virtual table is actually very simple.Basic Syntax:Copy codeThe
Meaning of compilation --------------------------------------------------------------------------------When SQLSERVER receives any command, including query, batch, stored procedure, trigger)Pre-compiled commands (prepared statement) and dynamic SQL
Copy codeThe Code is as follows:-- Create a test table and insert dataCreate table test (code varchar (50), [values] varchar (10), [count] int)INSERT test SELECT '001', 'AA', 1Union all select '001', 'bb ', 2Union all select '002 ', 'aaa', 4Union
Misunderstanding #1: After server failover, ongoing transactions continue to be executedOf course this is wrong!Each failover is accompanied by some form of recovery. However, if the transaction being executed does not have a Commit, the connection
Misunderstanding #12: The number of TempDB files must be consistent with the number of CPUs
Error
Alas, the above misunderstanding is Microsoft's "official" suggestion, and there are still a large number of blog posts sticking to this viewpoint.
What should we do if we need to modify the SQL server table structure? The following describes how to modify the SQL server table structure.Add a varchar column to the SQL server table:Alter table distributors add column address varchar (30 );Delete
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.