From the top-down query method, query out itself and all descendant data:--as(Selectfromwhere ID= Select fromwhere t.parentid=m.id)Select from Maco ORDER BY ID DescFrom the bottom up query, query out itself and all the direct
First, the database login
Server name:. Contact this machine
Authentication: Windows Authentication (Administrator rights) and SQL Server Authentication
Login name: SA (default login name)
II. Database Conventions
The
1. Declaration and use of variablesDECLARE @var as varchar (50)Set var= ' ABCD '2. If loopIf IsNull (@prjid, 0) =0Beginprint ' did not find prjid!!! ‘ReturnEndElseBegin--You must write some code here, otherwise you will get an error.End3, the use of
The concept of constraints: Ensure that valid values are entered in the columns and maintain relationships between the tables.Primary key ConstraintFunction: Primary KEY (PRIMARY KEY constraint), one table can only have one, cannot have null value,
I. Download the SQL Server R2 installation fileCn_sql_server_2008_r2_enterprise_x86_x64_ia64_dvd_522233.isoSecond, burning the installation files into a CD-ROM or using a virtual CD-ROM to load, or directly unzip, open the installation files, the
Read Catalogue
1.LEFT (character_expression, integer_expression)
2.RIGHT (character_expression, integer_expression)
3.SUBSTRING (character_expression, start, length)
In SQL Server we often need to
Read Catalogue
Way 1-round
Way 2-cast
Rounding in SQL usually has two ways: round and cast (... as decimal ()).The personal advice is to use the cast method:Back to TopWay toroundAfter testing, the same can be rounded, but round
Read Catalogue
SQL Server Functions---Union and UNION ALL differences
Back to top SQL Server functions---Union and UNION ALL differencesIf we need to display the results of the two SELECT statements as a whole, we need to use the union
Qlserver provides a rich system view, from macro to micro, from static to dynamic response database object storage results, system performance, system wait events and so on. It also retains a view of compatibility with earlier versions, the main
-------Adding constraints, increasing deletions1 UseStudentDB22 Go3 --------Create a student table---------4 Create TableStudentinfo (5 --StudentID int PRIMARY key NOT NULL identity,---set as primary key and self-growing6StudentIDint not NULL
If you want to uninstall SQL Server, uninstall the operating system directly!!!The reasons are as follows:
SQL Server is closely related to the operating system and calls the relevant components, which can cause many problems.
Clean up the
Before the SQL Server 2008R database was used because of the project requirements, after the installation is complete, you will encounter some problems when you log inThe problem is:When you connect locally, localhost,. etc. cannot log in directly,
Notes for SQL Server Alwayson agent job creation, sqlalwayson
Preface
Always On availability group activity auxiliary features include support for backup operations On secondary copies. Backup operations may put a lot of pressure on I/O and CPU
SQL Server queries problems by time period, SQL Server queries
Baidu's materials are saved as follows:
When writing SQL statements that query by time period, we generally write the query conditions as follows:
where date>='2010-01-01' and
SQL stored procedure instance-dynamically copies data from one table to another based on table data.
Dynamically copy data from one table to another based on the table data
Copy the records in the track table to the corresponding track _? Table
SQL Server float uncertainty
Most of the time, we all know that the floating point storage is an uncertain value, and you will never know whether it is something like 0 = 0.00000000000000123 or 0 = 0.00000000000999. There may be no problems at the
Analysis of insufficient System tablespace alarms and analysis of system table alarms
The Code is as follows:
-- After logging on to an alert with insufficient SYSTEM tablespace, the SYSTEM finds that sys. aud $ occupies too many places. SQL> select
SqlServer uses a common table expression (CTE) to build an infinite tree structure. sqlservercte
Starting from SQL Server 2005, we can use CTE to support recursive queries. CTE is the common table expression.
A common table expression (CTE) is a
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.