I encountered a problem today, and finally found that it was caused by insufficient understanding of @ identity, scope_identity () and ident_current. Write it down and give a prompt to new users like me.
There are two tables Table1 and Table2 at
-- Replace the original unitcodingCommunityReplace data with the new unitcodingCreate procedure DBO. sp_changeunitcoding(@ Oldunitcoding varchar (20 ),@ Newunitcoding varchar (20))AsDeclare @ returnvalue varchar (1)Begin Tran T1
-- 1Update tab_a
Returns the table name, index name, and number of rows.
Select object_name (I. object_id) as objectname, I. [name] As indexname, sum (P. Rows) as rowcnt
From SYS. Indexes I
Inner join SYS. partitions P
On I. object_id = P. object_id
And I. index_id =
View Code create view view_job_info
Select B. [name] [job name], case when B. Enabled = 1 then' enable 'else' disable 'end [Enable]
, A. step_name [step name], A. Command
From MSDB. DBO. sysjobsteps a inner join
MSDB. DBO. sysjobs B on A. job_id = B.
A very valuable article:
Http://www.sqlstudy.com/ SQL _article.php? Id = 2008060701
One of the keys is set xact_abort on. [I personally think This is the simplest and most effective method]
If try catch is applied, use the following system
The most common errors in SQL Server connection:1. "SQL server does not exist or access is denied"This is the most complex. There are many causes of errors and there are many aspects to check.Generally, there are several possibilities:1. incorrect
Yesterday, a friend sent a piece of SQL stored procedure (as shown below). Let me see if it can be optimized.
Insert @ T1
Select g_no, co_no, si_no, str_no, sum (ind_qty) as Qty
From instock_detail where in_id = @ ID group by g_no, co_no, si_no, str_
Data import and export will be used when SQL Server programming or management is involved. There are many ways to import and export data, which can be summarized based on my experiences in Project Creation:
1. SQL Server Import and Export wizard.
I. Introduction to raid
RAID (Redundant Array of independent disk independent redundant disk array) is a data protection policy.
Ii. Several Common RAID levels
1. RAID 0:
Data I/O can be improved through parallel reading. reading efficiency is
Iii. SQL Server unpatched vulnerabilities
John's SQL Server is installed on Win 2000, with no patching and no patching, no matter how strict your permission settings are, they are all broken. The following example is an attack on the vulnerable
Http://www.cnblogs.com/changbluesky/archive/2010/05/07/1729519.html
PS. Too lazy to write, too lazy to summarize, copy a good summary, but there are some not said, in short, several errors encountered when the null should be considered more test
I
Create a function:Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->If exists (select * From DBO. sysobjects where id = object_id (n' [DBO]. [f_sheetname] ') and xtype in (n'fn', n'if', n'tf
The most common method to automatically generate a primary key is:
1. the identity attribute treats the original seed value as its first parameter and the increment value as its second parameter value.
2. specify your field as the unique identifier
1. Publishing and subscriptionUse forced subscription to synchronize DatabasesLarge amounts of data and batch data can be processed using the database synchronization mechanism://Note:Publishing Server (distribution) operation, subscription server
Exists Structure
The exists structure is a tsql function, which returns a Boolean variable for the subquery in parentheses. If the subquery returns any row, the structure returns true; otherwise, it returns false. This structure is especially
@ Servername: return the name of the local server running SQL Server 2000.@ Remserver: return the name of the Remote SQL Server server recorded in the logon record.@ Connections: returns the number of connections or attempts to connect to the SQL
As a DBA, it not only helps developers Write Excellent query scripts, but also efficient data storage architecture. In fact, most of the time is in operation and maintenance, and most of the work time is not saturated, but why are some DBAs so busy,
Select * From sysobjects where (xtype = 'U ')
Xtype = 'U' indicates the xtype char (2) object type. It can be one of the following object types:C = check ConstraintsD = default value orDefault ConstraintF = foreign key constraintL = LogFn = scalar
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.