SQLServerͨÓ÷ÖÒ³´æ´¢¹ý³Ì£¬×Ö·û·Ö¸ôº¯Êý
·ÖÒ³´æ´¢¹ý³Ì
sp_QueryPaging
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author:
-- Create date:
-- Description: ·ÖÒ³²éѯ
-- ·µ»ØµÄÊý¾ÝÖÐ×ÜÊÇÔÚÿÌõ¼Ç¼ǰ¼ÓÉÏÐкÅRowNumberÁС£
-- Èç¹ûδָ¶¨@StrSelect²ÎÊý£¬Ï൱ÓÚÉèÖÃËüΪ'*'
-- Èç¹ûδָ¶¨@Strfrom²ÎÊý£¬²»×ö²éѯ£¬·µ»Ø-1
-- Èç¹ûδָ¶¨@StrWhere²ÎÊý£¬ÔòºöÂÔWhereÌõ¼þ
-- Èç¹ûδָ¶¨@StrOrder²ÎÊý£¬ÊÔ×Å×Ô¶¯»ñµÃ±êʶÁÐ×÷Ϊ@StrOrder£¬Ê§°ÜÔò²»×ö²éѯ£¬·µ»Ø-1
-- Èç¹ûδָ¶¨@PageSize²ÎÊý£¬»òÕßËü<=0£¬Ôò·µ»ØÈ«²¿¼Ç¼
-- Èç¹ûδָ¶¨@PageIndex²ÎÊý£¬»áÉèÖÃËüΪ1£¬ÏÔʾµÚÒ»Ò³Êý¾Ý
-- ²Î¿¼£ºshiwenbin http://www.cnblogs.com/virusswb/archive/2009/10/20/1587179.html
-- =============================================
ALTER PROCEDURE [dbo].[sp_QueryPaging]
@StrSelect NVARCHAR(4000) = '*' , --ÓûÏÔʾµÄÁУ¨¶àÁÐÓöººÅ·Ö¿ª£©£¬ÀýÈ磺id,name
@Strfrom NVARCHAR(4000) , --±íÃû³Æ£¬»òÕßÊDZíÁ¬½Ó×Ö·û´®£¬¶à±íÁ¬½ÓÀýÈç:student as s inner join dwinfo as dw on s.dwbh=dw.bh
@StrWhere NVARCHAR(4000) = '' , --²éѯÌõ¼þ,''´ú±íûÓÐÌõ¼þ£¬µ¥Ìõ¼þ»òÕ߶àÌõ¼þ£¬¶àÌõ¼þÀýÈ磺name='°¡' and id=10
@StrOrder NVARCHAR(4000) , --ÅÅÐòÁÐ(¶à¸öÅÅÐòÁÐÓöººÅ·Ö¿ª£©£¬ÀýÈç:id desc,name as
@PageSize INT = 0 , --ÿҳÏÔʾÌõÊý
@PageIndex INT = 1 , --µ±Ç°Ò³
@RecordCount BIGINT = -1 OUTPUT --·µ»Øµ±Ç°Ò³¼Ç¼Êý
AS
BEGIN
SET NOCOUNT ON ;
IF @Strfrom IS NULL
BEGIN
RETURN -1
END
--ÈôûÓÐÖ¸¶¨@StrOrder£¬ÊÔ×Å»ñÈ¡±êʶÁÐ
IF @StrOrder IS NULL
BEGIN
DECLARE @identitycol NVARCHAR(50)
SET @identitycol = ( SELECT TOP ( 1 )
COLUMN_NAME
from INFORMATION_SCHEMA.columns
WHERE TABLE_NAME = @Strfrom
AND COLUMNPROPERTY(OBJECT_ID(@Strfrom),
COLUMN_N
Ïà¹ØÎĵµ£º
/*
*SQLServerÌí¼Ó²Ù×÷ʵÏÖ
*/
void CMFCSQLDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CString strsql;
CString strnum="mynum3";
CString strage="myage3";
HRESULT hResult;
_variant_t RecordsAffected;
CoInitialize(NULL);
_ConnectionPtr m_pAppConn;
hResul ......
Êý¾Ý¿â×Öµä°üÀ¨±í½á¹¹(·Ö2KºÍ2005£©¡¢Ë÷ÒýºÍÖ÷¼ü.Íâ¼ü.Ô¼Êø.ÊÓͼ.º¯Êý.´æ´¢¹ý³Ì.´¥·¢Æ÷.¹æÔò¡£¿ÉÒÔÔÚÆóÒµ¹ÜÀíÆ÷¡¢²éѯ·ÖÎöÆ÷Öмòµ¥Ö´ÐУ¬Ö±½ÓÁ˵±µÄ²é³öSQL2K¼°SQL2005µÄËùÓÐÊý¾Ý×ֵ䣬·½±ãÎĵµµÄ±àд£¬Ï£Íû¶Ô´ó¼ÒÓаïÖú¡£
1. SqlServer2000Êý¾Ý¿â×Öµä--±í½á¹¹.sql
SELECT TOP 100 PERCENT --a.id,
& ......
ÈçºÎ»ñµÃsqlserverÊý¾Ý¿âÖÐÕ¼ÓøßcpuÓû§µÄ»î¶¯ÄÚÈÝ
1¡¢´Ó΢ÈíÕ¾µãÉÏÏÂÔØqslice_setup.exe
2¡¢´ò¿ªQuery Analyzer£¬ÔËÐÐÒÔÏÂÓï¾ä£º
declare @a int
while (1<2)
begin
select @a=1
end
½«»á·¢ÏÖcpuÂíÉÏ´ïµ½100%
3¡¢´ò¿ªqlice.exe£¬½«·¢ÏÖsqlserver.exeµÄcpuÕ¼ÓÃÂʺܸߣ¬Ë«»÷½øÈ룬³öÐÐsqlserver.exeÖоßÌåÏß³ ......
Óαê²Ù×÷µÄÁù²½Öè:
¡ôÔÚÿ´ÎÔÚ´´½¨ÓαêµÄʱºò¶¼ÎÊÎÊ×Ô¼º,ÓÃʲô±ðµÄ·½·¨¿ÉÒÔ±ÜÃâʹÓÃÓαê,ÄÇôÄã¾Í²½ÈçÉè¼ÆµÄÕý¹æÁË.
1.ÉùÃ÷
2.´ò¿ª
3.Ó¦ÓÃ/²Ù×÷
4.¹Ø±Õ.
5.ÊÍ·Å
&nbs ......
http://www.tongyi.net/article/20031101/200311013786.shtml
ËùνµÄÊý¾Ý´«Ê䣬ÆäʵÊÇÖ¸SQLServer·ÃÎÊAccess¡¢Excel¼äµÄÊý¾Ý¡£
ΪʲôҪ¿¼Âǵ½Õâ¸öÎÊÌâÄØ£¿
ÓÉÓÚÀúÊ·µÄÔÒò£¬¿Í»§ÒÔÇ°µÄÊý¾ÝºÜ¶à¶¼ÊÇÔÚ´æÈëÔÚÎı¾Êý¾Ý¿âÖУ¬ÈçAcess¡¢Excel¡¢Foxpro¡£ÏÖÔÚϵͳÉý¼¶¼°Êý¾Ý¿â·þÎñÆ÷ÈçSQLServer¡¢ORACLEºó£¬¾³£ÐèÒª·ÃÎÊÎı¾Êý ......