ArticleDirectory
SQL Server Returns the automatic ID of the last inserted record
SQL Server Returns the auto-increment Number of the inserted records (including multi-Table insertion)
SQL Server Returns the automatic ID of
Query the structure of a user table:
Select
Table Name
=
Case
When
A. colorder
Is
Not
Null
Then
D. Name
Else
''
End
,FIELD No.
=
A. colorder,Field name
=
A. Name,Identifier
=
Case
1: In order to reduce the number of database connections for storing large volumes of data, you can use XML to store data at one time. ReferenceCodeAs follows:
SQL XML format
Code highlighting produced by Actipro CodeHighlighter (freeware)http:/
Explicitly converts a data type expression to another data type. Cast and convert provide similar functions. Syntax
Use cast:
Cast (expression as data_type)
Use convert:
Convert (data_type [(length)], expression [, style]) Parameters
1. query repeated fields in the table
Select ID From Table1 Where ID In(Select ID From Table1 Group By IDHavingCount(ID)>1)
2. Add auto-incrementing columns to the SELECT query as the ID column
Example:Select(Select Sum(1)FromTable1WhereIDA. ID)
1. Database Replication
SQL Server 2008 database replication synchronizes data between multiple servers through the publishing/subscription mechanism. We use this mechanism for Synchronous database backup. The synchronous backup here refers to the
We are familiar with the like statement. For example, to find all users whose usernames contain "C", we can use mydatabase
Select * From Table1 where username like '% C %"
The following is another way to complete the above functions:
Use
Address: http://www.isstudy.com/sqlser/2717.html
The dateadd function is used to return a new datetime value based on a specified date.Syntax:Dateadd (datepart, number, date)Parameter description:Datepart: Specifies the part of the date to which
Address: http://bigdata.ccidnet.com/art/1106/20120612/3947919_1.html
Unicode Character Set is generated to solve the incompatibility problem of character sets. All its characters are expressed in two bytes, that is, English characters are also
You can see this post on the Forum. The original Article is as follows:
On My SQL Server R2, I tried it. As a result, an error is returned when it is converted to numeric ..
It seems strange that the returned value of isnumberic is 1, but the
During cluster maintenance of SQL Server 2005, the following problem occurs:
When the resource group is on one node, log on to the database with SA and view the attributes of the user database from management studio. This is normal, but when the
Trigger createdCode
Create Trigger Tg_projectname On Table1After Update As Update Table 2 Set [ Project name ] = B. Project Name From Table2 A, inserted B Where A. projid = B. ID
Description of inserted and deleted
Method 1:Use OpenDataSourceThe following is an example of cross-sqlserver query.Select tablea. *, tableb. * From OpenDataSource ('Sqlodb ','Data source = servera; user id = userid; Password = password'). Databaseaname. DBO. tableaLeft
In SQL Server 2005, you can use% Lockress %Obtain the physical path information corresponding to the data row.% Physloc %Obtain and useSYS. fn_physlocformatterAfter the binary data is converted% Lockress %But these are not described in msdn.
%
open the park today and share the data backup and storage process that I have been using. Thank you for reprinting !!!
Use [Master] goset ansi_nulls ongoset quoted_identifier offgocreate proc [DBO]. [SQL _backup] @ database nvarchar (50) asdump
We often encounter this situation when using sqlserver. When the structure of a table is modified, the related views are incorrect.ProgramTherefore, there is a stored procedure.
Create procedure refreshallview as declare mycursor cursor
Original article address:
Http://www.cnblogs.com/CareySon/archive/2012/06/20/IntroductToSQLServerReplicationPart1.html
Introduction
Replication in SQL Server is one of the core features of high availability of SQL Server. In my opinion,
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.