Batch insert and update in SQL Server (Stored Procedure)

1. cursor Mode CopyCode The Code is as follows: declare @ data nvarchar (max) Set @ DATA = '1, tanw, 2, keenboy '-- id, name Declare @ dataitem nvarchar (100) Declare data_cursor cursor for (select * From Split (@ data ,';')) Open

SQL Server temporary table usage

Usage: Temporary tables can be used to store related records for complex queries, which improves efficiency andProgramIs similarMy_cursor declare my_cursor cursor scrollFor select field from tablenameTemporary tables are divided into user

How to fix SQL Server errors

In the tutorial windows 11th Server Installation and setup tutorial-mssql security Article 1 (run ms SQL Server under a common user), the author said step 1 "after setting directory permissions, the ms SQL Server Running user needs to be set to

SQL Server statistics collection

1. Calculate the total score and rank each person Select name, sum (score) as allscore from stuscore group by name order by allscore 2. Calculate the total score and rank each person Select distinct t1.name, t1.stuid, t2.allscore from

SQL Server uses stored procedures to remove duplicate rows of SQL statements

Or first Code Let's take a look at the SQL statement to remove duplicate records and obtain duplicate records. Copy code The Code is as follows: Alter procedure [DBO]. [proc_itemmaster_getunique] @ pageindex int, @ uid int, @ itemnumber varchar (50

Restore heap table records by mistake in simple SQL Server mode (bypassing header verification)

First of all, I need to emphasize that this article aims to reveal the principle of recovering the deletion records of heap tables. What I have considered does not apply to every situation of everyone. I hope you will forgive me ~ Many friends

SQL Server misunderstanding: About 27th days using BACKUP WITH CHECKSUM can replace DBCC CheckDB

Misunderstanding #27: Using BACKUP... with checksum can replace DBCC CheckDB Error At first glance, because backup with checksum will detect the CHECKSUM values of all allocated pages, this misunderstanding seems to be the case, but in fact it is

Misunderstanding of SQL Server: Misunderstanding of fill factor on the seventh day on the 30th day

Misunderstanding #25: Multiple misunderstandings about fill Factors All are errors. 25a) Fill Factor always existsNo, it can be seen through Books Online (Translator: I did not find this sentence in the new version of the BOL ):Important:The fill

SQL Server misunderstanding: 18th-day discussion about FileStream storage, garbage collection, and other

Misunderstanding #18: Several misunderstandings related to FileStream All Errors 18 a) FileStream data can be stored remotely No, because the FileStream data container (which refers to the NTFS folder that stores the FileStream file, the fabricated

SQL Server misunderstanding: 8th-day misunderstanding about Online indexing

Misunderstanding #8: Online indexing does not lock related indexes Error! Online indexing is not as good as you think. The online index operation locks resources temporarily at the start and end of the operation. This may cause serious blocking

SQL Server misunderstanding: three misunderstandings about NULL bitmap on the seventh day on the 30th day

This also reduces the issue of CPU cache hit failure (click this link to view how the CPU cache works and the MESI protocol ). Let's expose three common mistakes related to NULL bitmap. Misunderstanding # 6a: NULL bitmap is not always

SQL Server misunderstanding: 4th-day DDL trigger is the INSTEAD trigger

Misunderstanding #4: DDL triggers (introduced after SQL Server 2005) are INSTEAD triggers This is wrong The implementation principle of DDL triggers is actually an AFTER trigger. This means that a DDL operation is performed first, and then the

C # How to import XML files to SQL Server

Question: How can I import an XML file to SQL Server 2000?Answer:: There are several ways to import XML files to SQL Server. Here, three of them are provided: Large-capacity load COM interface. To extract the object and attribute of a document to a

SQL Server CONVERT () function usage Summary

How to Use CONVERT: Format:CONVERT (data_type, expression [, style])Note:This style is generally in the time type (datetime, smalldatetime) and string type (nchar, nvarchar, char, varchar)It is used only when they are converted to each

SQL Server review transactions

Why use transactions? When updating multiple tables, an execution fails. Transaction rollback is required to maintain data integrity. Display Set transactions Copy codeThe Code is as follows: begin try Begin transaction Insert into shiwu (asd)

SQL Server lock TABLE statement sharing

Lock a table in the database SELECT * FROM table WITH (HOLDLOCK) Note: What is the difference between locking a database table? SELECT * FROM table WITH (HOLDLOCK) Other transactions can read tables, but cannot update or Delete tables. SELECT *

Common SQL server command line operations (start, stop, pause)

Start SQL server Net Start MSSqlServer Pause SQL server Net Pause MSSqlServer Restart the suspended SQL server Net Continue MSSqlServer Stop SQL server Net stop MSSqlServer Modify the SQL server sa password using the command line I have always

SQL Server not in statement causes the process to crash

Two organizational structure tables (Organise) and wage distribution History Table (WagePerMonthHis) The two tables are associated through Organise. Item_id and WagePerMonthHis. OrgIdS. In the Organise table (hereinafter referred to as the O table),

Summary of SQL server script update for Databases

Table replication: 1. insert into select statement Statement format: Insert into Table2 (field1, field2,...) select value1, value2,... from Table1 The target table Table2 must exist. Because the target table Table2 already exists, We can insert

SQL Server General Stored Procedure paging code (with ROW_NUMBER () and no ROW_NUMBER () For performance analysis)

Table Structure: Copy codeThe Code is as follows: create table [dbo]. [Xtest] ( [ID] [bigint] IDENTITY (1, 1) not null, [XName] [nvarchar] (50) NULL, [XDemo] [nvarchar] (500) NULL, CONSTRAINT [PK_xtest] PRIMARY KEY CLUSTERED ( [ID] ASC ) WITH

Total Pages: 923 1 .... 630 631 632 633 634 .... 923 Go to: GO

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.