My device on the 2000 data per second into the database, 2 devices a total of 4,000, when inserted in the program directly with the INSERT statement, the two devices at the same time to insert about a total of about 2,800, data loss about 1200 or so,
The code is as follows:Copy code If object_ID ('[proc_SelectForPager]') is not nullDrop Procedure [proc_SelectForPager]GoCreate Proc proc_SelectForPager(@ SQL varchar (max ),@ Order varchar (4000 ),@ CurrentPage int,@ PageSize int,@ TotalCount
-- Dynamic Processing
Select a. stuname, A. bzktypename, cast (A. bkcode as varbinary (max) even,Row_number () over (partition by stuname, bzktypename order by getdate () IDInto # T1From bklist-- Where stuname = 'lin Jianhui' Declare @ sql1
In addition, EXEC () can also break through this restriction, as mentioned in inside SQL server t-programming:
Concatenating VariablesIn SQL Server 2000, EXEC had an advantage over sp_executesql in terms of supporting longer input code. even though
The system table SYS. syscomments and System View SYS. SQL _modules are introduced before sp_helptext.
SYS. syscomments: Contains each view, rule, default value, trigger, check constraint, default constraint, and stored procedure in the
The question is a bit of a title ~ Sorry, it's actually a small New method. Let's share it with you.
In the database, there are always some field content that you want to truncate a string based on a specific Identifier, but you can't think of a
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Declare
@ Html
Varchar
(
Max
),
@ SQL
Nvarchar
(
Max
),
@ Tablename
Varchar
(
200
)
Set
@
Have you ever tried to worry about storing too many stored procedures when changing table fields?
Here we can solve your problem. It can help you find the stored procedures that contain the strings you specified for search.
Xtype:
C
=
How can I delete objects as quickly as possible?""---------------------------------------------------------------Go to the SQL query AnalyzerSelect your databaseStep 1: First modify the SQL table owner to DBOExec sp_msforeachtable 'exec
Database Table field data segmentation
Sometimes, to reduce the number of stored records, multiple records may be merged into one display. In this case, the other fields recorded in the table are the same, and only one field is changed. For example,
SQL stored procedures update data through multiple IDs, SQL stored procedures
The following is an example:
I want to add 1 to the name of some brands (that is, Brand_Name), and Brand_ID is the primary key. The SQL statement is easy to implement. But
1. xml. exist
If the input is an XQuery expression, 0, 1 or Null is returned. 0 indicates no, 1 indicates yes, and Null indicates that the input is Null.
2. xml. value
The input is an XQuery expression and returns an SQL Server scalar value.
3. xml.
Shard creation 2004.4
Copy codeThe Code is as follows:/* -- call example
Exec p_lockinfo1
--*/
Alter proc p_lockinfo1
@ Kill_lock_spid bit = 1, -- whether to kill the deadlock process; 1: Kill; 0: only show
@ Show_spid_if_nolock bit = 1 -- if there
The Trim function in the program is known to all, but in SQL, only LTRIM is required. RTRIM deletes the left and right blank characters instead of the specified characters, so we can write one by ourselves.Requirements:1. The front and back spaces
Sometimes we use batch operations to Split strings, but SQL Server does not have its own Split function, so we need to implement it ourselves. There's nothing to say. You need to use it directly. The code is as follows:Copy code SET ANSI_NULLS
concatenation (join) and segmentation (split) of MSSQL strings
Often a master uses select number from Master. spt_values WHERE type = ' P ', this is a good way to do it, but there are only 2048 digits, and the statement is too long and not
--Multiple data can be composed of more than one XML tree l insert
--Incoming XML tree as varchar parameter
Syntax for--insert xx select xxx from OPENXML () Insert data
-----------------------------------import, export XML--------------------------
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.