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

SQLµÄ·ÖÒ³²éѯ

·ÖÒ³²éѯµÄÔ­Àí£º
 Õâ¸öÖ»ÄÜÓÃÔÙSql2005¼°ÒÔÉϵİ汾
DECLARE @pagenum AS INT, @pagesize AS INT  
SET @pagenum = 2   
SET @pagesize = 3   
SELECT *   
from (SELECT ROW_NUMBER() OVER(ORDER BY score DESC, speaker) AS rownum,    
        speaker, track, score   
      from SpeakerStats) AS D   
WHERE rownum BETWEEN (@pagenum-1)*@pagesize+1 AND @pagenum*@pagesize  
Õâ¸öÊÊÓÃÖ§³ÖtopµÄsql
SELECT TOP (10) * from hy_hotel_info   
 WHERE hi_id >(SELECT MAX (hi_id)    
from (select top £¨2*10£© hi_id    
from hy_hotel_info order by hi_id) as talTMP ) order by hi_id   
Ò»¸ö·ÖÒ³²éѯµÄ´æ´¢¹ý³Ì
/****** ¶ÔÏó: StoredProcedure [dbo].[SP_Pagination] ½Å±¾ÈÕÆÚ: 05/05/2010 15:02:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_Pagination]
@tblName varchar(255), -- ±íÃû .
@strGetFields varchar(1000) ='* ', -- ÐèÒª·µ»ØµÄÁÐ
@fldName varchar(255)= ' ', -- ÅÅÐòµÄ×Ö¶ÎÃû
@PageSize int = 10, -- Ò³³ß´ç
@PageIndex int = 1, -- Ò³Âë
@doCount bit = 0, -- ·µ»Ø¼Ç¼×ÜÊý,·Ç 0 ÖµÔò·µ»Ø
@OrderType int = 0, -- ÉèÖÃÅÅÐòÀàÐÍ,·Ç 0 ÖµÔò½µÐò
@strWhere varchar(1500) =' ' , -- ²éѯÌõ¼þ(×¢Òâ: ²»Òª¼Ówhere)
@keyDate varchar(1500) =' '
AS
declare @strSQL varchar(5000) -- Ö÷Óï¾ä
declare @strTmp varchar(110) -- ÁÙʱ±äÁ¿
declare @strOrder varchar(400) -- ÅÅÐòÀàÐÍ
declare @fldNames varchar(100) -- ÅÅÐò×ֶΣ¬Èç¹ûÁ½Õűí,Ö»²éÑ


Ïà¹ØÎĵµ£º

SQLÈ¡³öµÚ m Ìõµ½µÚ n Ìõ¼Ç¼µÄ·½·¨

´ÓTable ±íÖÐÈ¡³öµÚ m Ìõµ½µÚ n ÌõµÄ¼Ç¼£º(Not In °æ±¾)
SELECT TOP n-m+1 *
  from Table
  WHERE (id NOT IN (SELECT TOP m-1 id from Table ))
--´ÓTABLE±íÖÐÈ¡³öµÚmµ½nÌõ¼Ç¼ (Exists°æ±¾)
SELECT TOP n-m+1 * from TABLE AS a WHERE Not Exists
(Select * from (Select Top m-1 * from TABLE orde ......

Ö´Ðлº´æÒÔÓÅ»¯SQL ServerµÄÄÚ´æÕ¼ÓÃ

×÷Õߣºsuperhasty
  2007-11-29
ÔÚÂÛ̳Éϳ£¼ûÓÐÅóÓѱ§Ô¹£¬ËµSQL ServerÌ«³ÔÄÚ´æÁË¡£ÕâÀï±ÊÕ߸ù¾Ý¾­Ñé¼òµ¥½éÉÜÒ»ÏÂÄÚ´æÏà¹ØµÄµ÷ÓÅ֪ʶ¡£Ê×ÏÈ˵Ã÷Ò»ÏÂSQL
ServerÄÚ´æÕ¼ÓÃÓÉÄļ¸²¿·Ö×é³É¡£SQL ServerÕ¼ÓõÄÄÚ´æÖ÷ÒªÓÉÈý²¿·Ö×é³É£ºÊý¾Ý»º´æ(Data
Buffer)¡¢Ö´Ðлº´æ(Procedure Cache)¡¢ÒÔ¼°SQL ServerÒýÇæ³ÌÐò¡£S ......

1.ʲô½ÐSQL×¢È룿ÈçºÎ·ÀÖ¹£¿Çë¾ÙÀý˵Ã÷

1.ʲô½ÐSQL×¢È룿ÈçºÎ·ÀÖ¹£¿Çë¾ÙÀý˵Ã÷
´ð£ºSQL×¢ÈëÊdz£¼ûµÄÀûÓóÌÐò©¶´½øÐй¥»÷µÄ·½·¨¡£µ¼ÖÂsql×¢Èë¹¥»÷²¢·ÇϵͳÔì³ÉµÄ£¬Ö÷ÒªÊdzÌÐòÖкöÂÔÁË°²È«ÒòËØ£¬ÀûÓÃsqlÓïÑÔ©¶´»ñµÃºÏ·¨Éí·ÝµÇ½ϵͳ 
ÀýÈ磺
"Select * from users where name='"+uName+"' and pwd='"+uPwd+"' " ......

ÔÚEclipseÖÐÓÃJDBCÁ¬½ÓSql Server 2005×ܽá

* ×î½üÒòΪ¿ª·¢»î¶¯ÐèÒª,ÓÃÉÏÁËEclipse,²¢ÒªÇóʹÓþ«¼ò°æµÄSQL(¼´ 2005)À´½øÐпª·¢ÏîÄ¿ * 
1.×¼±¸¹¤×÷: ×¼±¸Ïà¹ØµÄÈí¼þ(Eclipse³ýÍâ,¿ªÔ´Èí¼þ¿ÉÒÔ´Ó¹ÙÍøÏÂÔØ) 
<1>.Microsoft 2005 Express Edition 
ÏÂÔصØÖ·:http://download.microsoft.com/download/0/9/0 ......

sqlÓïÑÔ£ºÈçºÎÅжÏ×Ö¶ÎÊÇ·ñ´æÔÚ£¬ÈçºÎɾ³ý¼°´´½¨×Ö¶Î

ÈçºÎÅжÏ×Ö¶ÎÊÇ·ñ´æÔÚ
 if col_length('±íÃû','×Ö¶Î1') is null  ALTER TABLE ±íÃû ADD ×Ö¶Î1 Nvarchar(50)  if col_length('±íÃû','×Ö¶Î2') is null  ALTER TABLE ±íÃû ADD ×Ö¶Î2 Nvarchar(50) ");
ɾ³ý×Ö¶Î
if col_length('±íÃû','×Ö¶Î1,') is not null  ALTER TABLE ±íÃû drop  c ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ