Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sql´æ´¢

declare @p int
declare @p1 int
declare @count int
set @p=0
set @p1=10
set @count=2
if(@count<>0 or @count<>1)
set @p=@p1*@count-10
SELECT [t1].[userid], [t1].[username], [t1].[userorder]
from (
    SELECT ROW_NUMBER() OVER (ORDER BY [t0].[userorder]) AS [ROW_NUMBER], [t0].[userid], [t0].[username], [t0].[userorder]
    from [dbo].[users] AS [t0]
    ) AS [t1]
WHERE [t1].[ROW_NUMBER] BETWEEN @p + 1 AND @p + @p1
USE [SC1]
GO
/****** Object:  StoredProcedure [dbo].[KB_ExaminationSearch_sp]    Script Date: 05/17/2010 08:55:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:  <peter>
-- Create date: <2010-03-15>
-- Description: <»ñÈ¡·¢²¼¿¼ÊÔÐÅÏ¢>
-- =============================================
ALTER PROCEDURE [dbo].[KB_ExaminationSearch_sp]
 @papecode NVARCHAR(10),
 @BExamdate NVARCHAR(50),
 @EExamdate NVARCHAR(50),
 @usercode  NVARCHAR(50),
 @subccode NVARCHAR(10), 
 @examstae NVARCHAR(50),
 @deptcode NVARCHAR(50),
 @BExamscor NVARCHAR(10),
    @EExamscor NVARCHAR(10),  
 @PageIndex INT,
    @PageSize INT,
 @RecordCount INT OUTPUT
AS
BEGIN
 
 DECLARE @sql  NVARCHAR(4000)
 DECLARE @fromWhere  NVARCHAR(3500)
 
 SET @fromWhere = ' from(SELECT CASE examstat WHEN ''0'' THEN ''δ·¢²¼'' WHEN ''1'' THEN ''ÒÑ·¢²¼'' WHEN ''2'' THEN ''´ýÅúÔÄ'' WHEN ''3'' THEN ''ÒÑÅúÔÄ''  WHEN ''4'' THEN ''Íê³É'' WHEN ''6'' THEN ''¿¼ÊÔÖÐ'' WHEN ''7'' THEN ''´ý¿¼'' ELSE ''ȱ¿¼'' END examstae,kbexam.*,kbpape.papname,aduser.userenam,subccode from PKKBEXAMM0 kbexam LEFT JOIN PKKBPAPEM0 kbpape ON kbexam.papecode = kbpape.papecode LEFT JOIN PKADUSERM0 aduser ON aduser.usercode =  kbexam.usercode)temp WHERE 1 = 1  '
 IF(@usercode


Ïà¹ØÎĵµ£º

Sql ÀïÃæ ROW_NUMBER Ó¦Óó¡¾°

ROW_NUMBER ·µ»Ø°´Ò»¶¨¹æÔòÅÅÐòµÄµ±Ç°¼Ç¼¶ÔÓ¦µÄÐкÅ
±ÈÈçÎÒÃÇÓÐÕâÑùÒ»¸öÓ¦Óó¡¾°£º
ÏÖÔÚÓиö±ÈÈü£¬ÐèÒª´ÓÍøÉϲÎÈüÕß´Ó´ÓÍøÂçÉϱ¨Ãû£¬È»ºóÈ¥×îÔ籨ÃûµÄ5¸öÈ˲μӱÈÈü£¬Îª´ËÎÒÃÇʵÏÖÈçÏ£º
1.Ϊ´ËÎÒÃÇÒª½¨Á¢Ò»ÕűíÀ´±£´æ±¨Ãû²ÎÈüÕßµÄÐÕÃû¼°Æð±¨Ãûʱ¼ä
CREATE 
TABLE [dbo].[UserEnroll](
[UserName] [nvarchar] ......

¡¾»ã×Ü¡¿SQL CODE ¾­µä·¾«²Ê


¡¾»ã×Ü¡¿SQL CODE --- ¾­µä·¾«²Ê
Êý¾Ý²Ù×÷Àà SQLHelper.cs
ÎÞÏÞ¼¶·ÖÀà ´æ´¢¹ý³Ì
°ÙÍò¼¶·ÖÒ³´æ´¢
SQL¾­µä¶ÌС´úÂëÊÕ¼¯ 
ѧÉú±í ¿Î³Ì±í ³É¼¨±í ½Ìʦ±í 50¸ö³£ÓÃsqlÓï¾ä
SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»
 
Óαê
¸ù¾Ý²»Í¬µÄÌõ¼þ²éѯ²»Í¬µÄ±í
INNER JOIN Óï·¨
master.dbo.spt_val ......

50ÖÖ·½·¨ÇÉÃîÓÅ»¯ÄãµÄSQL ServerÊý¾Ý¿â

Ô­ÎÄÁ´½Ó:http://blog.btidea.com/article.asp?id=440
²éѯËÙ¶ÈÂýµÄÔ­ÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ£º
¡¡¡¡
¡¡¡¡1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
¡¡¡¡
¡¡¡¡2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
¡¡¡¡
¡¡¡¡3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
¡¡¡¡
¡¡¡¡4¡¢ÄÚ´æ²»×ã
¡¡¡¡
¡¡¡¡5¡¢ÍøÂç ......

SQLÓÅ»¯ Ë÷Òý

(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï×ÖµäµÄÕýÎı ......

sql server 2008 µÄ°²×°

¸ø´ó¼Ò¸öѧϰÊý¾Ý¿âµÄÈí¼þ°É£¬sql server 2008£¬Õâ¸öÊÇ΢Èí¹«Ë¾µÄ×÷Æ·£¬²»´í£¬Ó¦¸ÃÊǷdz£²»´í£¬ÔÚµçÄÔÉÏ°²×°OracleÊý¾Ý¿âµÄ»°£¬ÄǸö±È½Ï´ó£¬¶øÇÒÔÚÍøÉÏÒ²²»ºÃÏÂÔØ£¬ÒªÊÇÁ¬½Óµ½Ñ§Ð£·þÎñÆ÷µÄ»°£¬Ò²ÊDz»¿ÉÄܵģ¬³ý·Ç´ó¼Ò¾­³£È¥»ú·¿ÉÏ»ú£¬µ«ÊÇÄǸöÒ²²»¿ª£¬·Ï»°²»¶à˵ÁË£¬´ó¼Òȥ΢Èí¹ÙÍøÏÂÔØÒ»¸ösql server 2008µÄÊÔÓðæµÄ°²×°ÎÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ