Adjust the current initial value of the auto-increment field in SQL Server

A few days ago, when I upgraded the database of a communtiy server from SQL 2000 to SQL 2005, I encountered a strange problem and reported the following error: Violation of primary key constraint 'pk _ cs_threads'. Cannot insert duplicate key in

Paging SQL Server Stored Procedure

/* -- Paging program implemented by stored procedures Displays page X of the specified table, view, and query result. In the case of primary keys or ID columns in the table, query the data directly from the original table. In other cases, use the

Summary of optimization principles of IN & amp; EXISTS and not in & amp; NOT EXISTS

1. Execution Process of EXISTS Select * from t1 where exists (select null from t2 where y = x)It can be understood:Copy codeThe Code is as follows:For x in (select * from t1)LoopIf (exists (select null from t2 where y = x. x)ThenOUTPUT THE RECORDEnd

How to Use case when syntax in SQL

No. Use case when instead.For example, the following statement shows the Chinese year and monthCopy codeThe Code is as follows:Select getdate () as date, case month (getdate ())When 11 then '11'When 12 then '12'Else substring ('february 5, 1234, 80

Mssql isql command details

For example, ISQL is very convenient when you perform advanced configurations, such as running database operations on a client or remotely. For example, what can I do if I intrude into a host with SQL services? ISQL is the best tool.Not only does

SQL cross-Server Query statements

Select * from OPENDATASOURCE ('Sqlodb ','Data Source = remote ip address; User ID = sa; Password = password'). Database Name. dbo. Table NameInsert local database name .. table name select * from OPENDATASOURCE ('Sqlodb ','Data Source = remote ip

SQL Server Log Recovery Method (deal with drop and truncate)

-- 1Use masterBackup database logTestTo disk = 'd: \ Program Files \ Microsoft SQL Server \ MSSQL10.MSSQLSERVER \ MSSQL \ Backup \ logTest. bak'With format-- 2Use logTestCreate table table_1 (Id int, test varchar (max ))Insert table_1 (Id, test)

SQL Server CONVERT Function Test Result

Copy codeThe Code is as follows:Select convert (varchar (100), GETDATE (), 0): 05 16 2006 AMSelect convert (varchar (100), GETDATE (), 1): 05/16/06Select convert (varchar (100), GETDATE (), 2): 06.05.16Select convert (varchar (100), GETDATE (), 3): 1

MsSql Stored Procedure paging code [multiple articles collected]

Copy codeThe Code is as follows:-- Usage instructions: This Code applies to MsSql2000 and is available for other databases, but not necessary.-- Create a stored procedureCreate procedure pagination@ TblName varchar (255), -- table name@ StrGetFields

Sqlserver compares columns in two tables

I. ProblemsTwo tables with 40 or 50 columns are given to find their same columns and different columns. 2. query the columns in two tables. A temporary table exists. -- # A, # B is a temporary table, which is automatically deleted after the current

Basic Syntax of SQL statements

Basic Syntax of SQL statementsYin Hong wrote this article, but I can't help but stick it here for viewing information.Because the original text is written in the word, the paragraph is a bit messy.1. The complete syntax of the Select statement is:

Exquisite SQL Statements page 1/2

Note: copy a table (only copy structure, source table name: a new table name: B)Select * into B from a where 1 <> 1Description: copy a table (copy data, source table name: a target table name: B)Insert into B (a, B, c) select d, e, f from

Use SQL Server to determine whether a file exists and then delete it (details)

In SQL Server, you can use the internal Stored Procedure xp_fileexist to determine whether a file exists. If yes, you can use xp_exist shell to delete the file. In addition to determining whether a file exists, xp_fileexist can also determine

Parse some details about SQL statement Count

The count Statement supports *, column name, constant, and variable, and can be modified with the distinct keyword, and count (column name) does not accumulate null records. Here are some examples to demonstrate the count rule: for example, to make

Installing MSDE2000 prompts you to use a strong SA password for security reasons

I downloaded msde2000a today. I tried to find the setup.exe installation program based on the normal installation environment. The error message is displayed in the dialog box: "To ensure security, you must use a strong SA password. Use the SAPWD

How to restore the database account username/User Name

After the system is reinstalled or the database is reinstalled, the user name is found in the database after the database is attached, but there is no login name in sqlserver. For example First, the user name has the User Name of the

Difference between. And: In SQLServer

The following is an SQL Server instance. The following SQL statements run in the 2008 environment:DECLARE @ g geography;SET @ g = geography: Parse ('linestring (-122.360 47.656,-122.343 47.656 )');SELECT @ g;SELECT @ g. ToString ();Result

Clever solution for SQL query of continuous number segments

There is a clever SQL technique on ITPUB. Learn it and record it here.The initial problem was as follows:I have a table structure,Fphm, kshmInt32 00000001Int32 00000002Int32 00000003Int32 00000004Int32 00000005Int32 00000007Int32 00000008Int32 000000

Code for querying stored procedures by tens of millions of pages on SQL server

/*************************************** ***** **************************************** * ******************** Parameter description: 1. tables: Table Name, view 2. primaryKey: Primary keyword 3. sort: Sorting statement without Order By such as

MSSQL monitors database DDL operations (create, modify, delete stored procedures, create, modify, and delete tables)

Sometimes, a database has multiple accounts, including database administrators, developers, and O & M support personnel. Many accounts may have relatively high permissions, for example, DDL operation permissions (creation, modification, deletion of

Total Pages: 923 1 .... 399 400 401 402 403 .... 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.