Copy Code code as follows:
CREATE PROCEDURE [dbo]. [Up_pager]
@table varchar (2000),--table name
@col varchar (50),--Paging by this column
@orderby bit,--sort, 0-order, 1-Descending
@collist varchar,--The list of fields to query, *
1. Expand the server object--> linked server--> right click "New Linked Server"
Note: You must be logged on as a database administrator (usually the SA account) before you can create a linked server
2. Enter the IP of the linked server
3. Set
If we insert a value in the identity column, for example:
Copy Code code as follows:
Insert member (ID,USERNAME) VALUES (' admin ')
The error message is returned in the Query Analyzer:[Plain]Reference contentServer: Message 544,
Table types can be used in stored procedures for bulk additionsTable type definition:
Copy Code code as follows:
The CREATE TYPE dbo. Subcardtable as Table
(
[SC_ID] [varchar] (50),
[ZHUKAINFO_ID] [varchar]
batch execution of SQL files with Osql/ocmd batch
Note: In the above illustration we can see that osql does not support all the features of SQL Server 2008, and if you need to use all of the features of SQL Server 2008, you can use the Ocmd
SQL SERVER formula for calculating distances based on map latitude and longitude
Copy Code code as follows:
Go
--Create latitude and longitude distance calculation function
createfunction [dbo]. [Fngetdistance]
--latbegin begins
There are two extended stored procedures in SQL Server that implement the scanf and printf features, and use them appropriately to simplify the SQL code significantly when extracting and stitching strings.
1, xp_sscanf, use it to decompose a
There are three keywords in SQL Server that can modify comparison operators: All, any, and some, where some and any are equivalent.
the official Reference documentHttp://technet.microsoft.com/zh-cn/library/ms187074%28SQL.90%29.aspx
They work
Set SQL Server to use Row_number when not sorted
--1. See NHibernate is so written pagination, it is easier to understand the writing (there should be no efficiency problems?) )
--with just set an alias?
[SQL]
With query as (select Row_number ()
Fixed server role Description
The sysadmin carries out any activity in SQL Server. The role's permissions span all other fixed server roles.
ServerAdmin Configure server-wide settings.
Setupadmin add and remove linked servers and perform certain
When writing SQL statements, many times you use filter to filter out some records, SQL to filter the criteria for short: SARG (search Argument/sarg)
Copy Code code as follows:
where amount>4000 and amount
Of course, this isn't about SQL
Error message: Error mssqlserversqlserveragent could not be started (Reason:sqlserveragent must be able to connect to SQL Server as SysAdmin, but "(unknown)" is not Sy Members of the Sadmin role).
Operating Environment: WINDOWS2003R2 32bit + mssql2
Many friends ask the SQL Server database "Generate script" to export only the SQL scripts for the database, while the table and table data still do not come out. Very simple, look at the tutorial:
Note: I use the SQLServer2008 here, the other
Method 1:
Copy Code code as follows:
TRUNCATE TABLE TableName
When you delete all the data in a table, it automatically grows zero.
If there is a foreign key reference to this table, this method will be an error (even if the primary
In this article, I'll show you how to use SQL Server's tools to optimize the usage of database indexes, and this article also involves general knowledge about indexes.
common sense About indexing
The biggest factor that affects
SQL Server caches frequently used data in memory (that is, the data page cache) to increase the speed of data access. Because disk access is much slower than memory, reducing disk traffic is also an important aspect of database optimization.
When
The first is the most traditional way of writing, using variables in the stored procedure as a paging multiplier
Copy Code code as follows:
[C-sharp] View plaincopyprint?create proc P_paged1
@pageSize int, @currentPage int
As
When designing a primary key, you often need to consider the following points:
1. Meaningless: The meaningless here is defined from the user's point of view. This nonsense also reduces the information redundancy of the database to some extent. It
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