server| Reference | grammar | Grammar reference
I. Data definition DDL (data definition Language)
Data definition language refers to the language defined in the format and form of data, he is the first to be set up when each database is to be established, what is the form of data, the form of a field key, tables and tables of the relationship between the reference and so on, are in the beginning must be planned.
1, build the form:
CREATE TABLE table_n
Source: Click to open the link
Scenario:
Recently, a DB Server occasionally experienced CPU alarms. My mail alarm threshold (please read y threshold) is set to 15%. It didn't take the case at the beginning. I thought it was a statistical query, later, it became more and more frequent.
Exploration:
I decided to check what the fault was. The Troubleshooting sequence is as follows:
1. First enable Cacti monito
) Column Manipulation syntax? Add column birthday, with the columns keywordALTER TABLE Sys_useradd COLUMN birthday char (n) not null;? Modify column birthday, with modify keywordALTER TABLE sys_usermodify Birthday char (10);? Delete Column birthday, with drop-column keywordALTER TABLE Sys_userdrop column birthday;? Modify the column name and properties, modify the birthday to CSRQ, and change the property to char (10) and not allow NULL for NULLALTER
From Click on Open link
Scene:
A recent DB server occasional CPU alarm, my email alarm threshold (Please read yù) value set is 15%, the beginning is not the case, thinking is what the statistical category of inquiries, and then more frequent.
Explore:
I decided to check to see what was going on, and the Order of my troubleshooting was as follows:
1, first turn on cacti monitoring, found that the most r
Tags: Define variable--simple assignment declare @a int set @a=5 print @a--Assign value using SELECT statement declare @user1 nvarchar select @user1 = ' Zhang San ' print @user1 declare @user2 nvarchar Select @user2 = Name from St_user where id=1 print @user2--Use the UPDATE statement to assign a value DECLA Re @user3 nvarchar update st_user set @user3 = Name where id=1 print @user3 Two, table, temp table, table variable--Create temporary table 1 creation table # Du_user1 ([ID] [int] NOT NULL,
be returned by the Select, Update,delete, database table;3. You must return a scalar value or a table variable custom function is generally used in a high degree of reuse, simple function, a strong fight against the place. Second, the stored procedure1. Cannot return table variable2less restrictive, can perform operations on database tables, can return datasets3. You can return a scalar value, or omit the return stored procedure is generally used in the implementation of complex functions, data
Search for a lot of related information on the Internet and summarize the reasons for this situation mainly because of sorting rules:If no sorting rule is specifiedWhether the temporary table is case sensitive depends on the order of the tempdb database.Whether database objects are case sensitive depends on Database sorting rules.Whether the variables are case se
Label:Recently have been looking at SQL Server books, but look at the basic query flow, query in the work of the most, so it is important to correctly query the desired data. See in the book in SQL Server 2012 a new implementation of paging Query method, feel more convenient than the original, so record, if can help ev
When I checked the SQL statement syntax in SQL server2008r2, the SQL Server prompt
A fatal scripting error occurred.Incorrect syntax was encountered while parsing go.
After checking the boss for a while, I found that it was ca
TABLE Sys_user modify birthday char (10); Ø Delete Column birthday, have drop column keyword ALTER TABLE sys_user drop column birthday; Ø Modify the column name and attributes; Modify the birthday to CSRQ, and change the property to char (10) and not allow null not nulls ALTER TABLE Sys_user change birthday Csrq char (a) not null; 6) Modify the table name Rename table MyTable to youtable; 2. SQL SERVER D
The syntax is as follows: 1 Description: copy a table (only copy structure, source table name: a new table name: B) (access available)Method 1: Select * Into B From A Where 1 1 Method 2: Select Top 0 * Into B From A
2Description: Copy table (copy data, source table name: A target table name: B) (access available)Insert IntoB (A, B, C)SelectD, E, FFromA;
3. Create Table # mytemptable (COLA int primary
SQL Server 2000 installation: command line option syntax error, TYPE command /? For help Solution
When installedProgramInstall:The installer is installing the MS data access component.The screen prompts an error:Command Line option syntax error, TYPE command /? For helpClick "OK" to continue. The result is
what:Alter Table Add Check "' ); Alter Table Add constraint Unique (product_no); Alter Table Add Foreign Key references product_groups;To add a non-null constraint that cannot be written as a table constraint, use the following syntax:Alter Table Alter column Set not null;This constraint is checked immediately, so the table must conform to the constraint before adding the constraint.2.6.4. Deleting a constraintTo delete a constraint, you need to know its name. If you give it a name, it's a go
Manager, as shown in
The data source created through ODBC can be queried in the alias option, and its port number is configured as 45000. the above description shows that both ODBC and udl methods can be accessed normally, test again. Delete the record in the above alias and find that ODBC and udl methods cannot be accessed correctly. Therefore, we can infer that both ODBC and udl have accessed the server through this alias, but why does
1. @ identity last_insert_rowid ()2. Select Cn = count (*) from... select count (*) Cn from...3. Limit startindex, itemcn startindex starts from 0, while row_number () starts from 1.4. There is no select top in SQLite. Use Limit.5. SQLite auto-increment field. If data insertion fails in the transaction, the post-increment ID is not used, and the corresponding ID in SQL Server is invalid.6. SQLite does not h
: several simple basic SQL statements
-- Select: select * from table1 -- insert: insert into table1 (field1, field2) values (value1, value2) -- delete: delete from table1 -- where range -- Update: update table1 set field1 = value1 -- where range -- Query: select * from table1 where field1 like '% value1 %' -- sort: select * from table1 order by field1, field2 [desc] -- total: select count as totalcount from table1 -- sum: select sum (field1) as sumva
For accidental reasons, when the inner join table is required, the corresponding field must beCase Sensitive. By default, SQL Server databases are case-insensitive. How can this problem be solved?
To achieve this, there must be at least three operation levels:
1.Database level: The entire databaseChar,Varchar,Text,Nchar,NvarcharAndNtextThe data is
server|sqlserver| First type: (cricket)
ALTER TABLE TB
ALTER COLUMN colname nvarchar (MB) COLLATE chinese_prc_ci_as
--No case sensitive
ALTER TABLE TB
ALTER COLUMN colname nvarchar (MB) COLLATE chinese_prc_cs_as
--Case sensitive
ALTER DATABASE COLLATE Chinese_prc_cs_as
The second type: (tree)
--Create the following user-defined functions (UDF)
CREATE FUNCTION S
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.