The SQL error log records various problems encountered during database operation and some important information. As a troubleshooting requirement, we usually do not take the initiative to clean up these log files. Only when the server is restarted,
SQL Server uses exec to process SQL strings containing variables. Prompt: the scalar variable @ must be declared (solved !)Copy codeThe Code is as follows:Declare @ tssj nvarchar (100) -- external variableDeclare @ SQL _ SQL nvarchar (100) -- save
A "virtual" server composed of two or more physical independent servers is called a cluster server. A MicroSoft service called MicroSoft cluster service (MSC) manages cluster servers. An SQL Server cluster is a virtual Server composed of two or more
These days I am going to talk about the SQL Server 2008 course. On the first day of today, the organizer prepared the environment to use the same virtual machine, and then distributed it to many experimental machines, the name of the brain is
The following describes how to write SQL statements for the field names of a query table. SQL statements can provide many functions. We hope that you can learn how to use SQL statements.
Select name from syscolumns where id = (select id from
The meaning of the four matching characters % indicates zero or multiple arbitrary characters. It indicates any character in the specified range []. Any single character [^] is not in the specified range. the character string must be enclosed in
Execute sp_attach_db or sp_attach_single_file_db in QA. The following message is displayed: Error 1813: failed to open the new database 'dbname'. create database will be terminated. Device activation error. The physical file name 'd: SQL
To solve this problem, Insus. NET only creates another table, which stores the table to be tracked and the fields to be tracked in the table.Create another table [Audit], that is, the table storing the tracking records:Copy codeThe Code is as
Direct error reporting without using dynamic statementsIncorrectCopy codeThe Code is as follows:Alter proc testpapersAsBeginDeclare @ tems nvarchar (max), @ zidaun nvarchar (max)Set @ tems = select * from @ tems order by @ zidaunExec (@ tems)EndExec
Copy codeThe Code is as follows:-- Based on MAX (MIN) IDCreate proc [dbo]. [proc_select_id]@ Pageindex int = 1, -- current page number@ Pagesize int = 10, -- size of each page@ Tablename VARCHAR (50) = '', -- table name@ Fields VARCHAR (1000) = '', -
The following is a test example.1. Create two temporary tables and input test data:Copy codeThe Code is as follows:Create table # temptest1(Id int,Name1 varchar (50 ),Age int)Create table # temptest2(Id int,Name1 varchar (50 ),Age int)
The
Sometimes, we need to monitor the changes of a table in an important period, including insertion, update, and deletion. For example, when we export data to an external system, we want to export all the data, and it is best to export the changed data
The NULL value affects the query condition results, and the results are very subtle.
The following table lists the true values of AND, OR, and not in SQL.
Truth Table of table 1 AND
TRUE
FALSE
NULL
TRUE
TRUE
FALSE
Pattern Matching in search criteriaThe LIKE keyword searches for the string, date, or time value that matches the specified pattern. The LIKE keyword uses the regular expression to include the pattern to be matched by the value. The mode contains
Copy codeThe Code is as follows:-Determines whether some fields are empty.-- CaseSelect case when 'field name' is null then' \ n' else convert (varchar (20), 'field name') end as 'newname'Select case when null is null then' \ n' else convert
Once met, almost crazy, a friend installed MSSQL, hurry and try to delete the following components. of course, the premise is that you have to delete your own database, otherwise many functions will not be available after the component is deleted.
When I used the new SQL Server2005 function to construct the paging storage process, I mentioned using the ROW_NUMBER () function to replace top to implement the paging storage process.However, after a long time, we found a new problem, that is,
Copy codeThe Code is as follows:--- This is an example in the human affairs system. It is required to record the employee's absence status.--- 1. Recording the absence score in the table is a penalty score for those who are often absent.--- Rules:---
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.