Copy CodeThe code is as follows:
/*01.
Introduction to 02.sql XML:
--by Jinjazz
--http://blog.csdn.net/jinjazz
25l
06.1, XML: Ability to recognize elements, attributes, and values
07.
08.2, XPath: Addressing language, lookup similar to Windows
Let me show you the picture.
The above figure stored procedure called Mup_geta (I wiped out the name associated with the project)
The above illustration uses the SQL Server Graphics manager's own features to view objects that depend on Mup_geta.
Using the new features of SQL Server 2005 Now_number and CTE can be implemented well.
Examples are as follows:
Set up test data:
Copy CodeThe code is as follows:
CREATE TABLE Dup1
(
Col1 int NULL,
Col2 varchar () null
)
INSERT INTO DUP1 values
(1, "
1: The following is a relatively simple query method, through the query before the time and query after the difference between the calculation of
Copy Code code as follows:
DECLARE @begin_date datetime
DECLARE @end_date datetime
Select
MS SQL Server Chinese version of the preset date datetime format is YYYY-MM-DD hh:mm:ss.mmm
Long and Short date format
Copy CodeThe code is as follows:
--Short Date format: yyyy-m-d
SELECT REPLACE (CONVERT (varchar), GETDATE (), (), N '-0 ', '-')
--
The following code:
Method of being invoked:
Copy CodeThe code is as follows:
public static string Execommand (String commandtext)
{
Process P = new process ();
p.StartInfo.FileName = "cmd.exe";
P.startinfo.useshellexecute =
"Custom Functions" is our usual term, and "user-defined Functions" is a written version of SQL Server.
SQL Server 2000 allows users to create custom functions, and custom functions can have return values.
Custom functions are divided into:
CS Page calling code:
Copy CodeThe code is as follows:
public int totalpage = 0;
public int pagecurrent = 1;
public int PageSize = 25;
public int rowscount = 0;
string userid, username;
public datatable dt = new DataTable ();
public string path,
Copy Code code as follows:
Create Trigger Tgname
On TB
For update
As
If Update (recommend)
Begin
Update TB Set commenddate= (GETDATE ()) from TB inner join inserted on Tb.vlistid=inserted.vlistid
End
Recommend represents the field being
Method One: (This is the most commonly used, because many large sections of content use the text ntext and other data types, and we usually also replace the contents)
The varchar and nvarchar types are support replace, so if your text is no more
First back up the database in case of unnecessary loss. And then executes the varchar field with less than 8000 characters for all the horses being hanged.Copy CodeThe code is as follows:Update table name set field name =replace (field name, ' ', ')
Database:
300,000, with an ID column but no primary key, a nonclustered index is built on the category field to search
Procedure T-sql:
Copy Code code as follows:
/*
User-defined functions: Execution time is about 1150-1200 milliseconds
CREATE
However, in SQL performance is always relatively low, the steps to perform from SQL have the following differences in SQL with no in sql:
SQL attempts to convert the connection to multiple tables, and if the conversion is unsuccessful, execute the
No, take the case to replace it.
For example, the following statement shows the Chinese month
Copy CodeThe code is as follows:
Select GETDATE () as date, Case month (GETDATE ())
When one then ' 11 '
When then ' 12 '
else substring (' 1,234,567,890
Grammar
REPLACE (' String_expression1 ', ' string_expression2 ', ' String_expression3 ')
Parameter description
' String_expression1 '
The string expression to search for. String_expression1 can be either character data or binary data.
'
However, at this point user a exists in database A, and although new MSSQL can create user A, it cannot assign permissions to user A. Create a new User B bar, and the table and other information created by user A cannot be accessed again. Here's how
We often need to use the faceted function in our project, and I used to use the method now seems to be so clumsy, at that time is done, every time to do data paging on the table to do when the page, we do not laugh, before really stupid. Oh,
1. Table Damage Reason analysisThe following are common causes of MySQL table corruption:
1, the sudden loss of power to the server caused data file corruption.
2, forced shutdown, did not first shut down the MySQL service.
3. The mysqld process
Statement Description: Copy table (copy structure only, source table name: A new table name: b)
Sql:select * into B from a where 1<>1
Description: Copy table (copy data, source table name: A target table name: b)
Sql:insert into B (A, B, c)
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.