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

SQL SERVER 2005¹ý³Ì·ÖÒ³

AspNetPagerÊÇÒ»¸ö±È½ÏºÃµÄ·ÖÒ³¿Ø¼þ,¸Ã¿Ø¼þʹÓùý³Ì·Öҳʮ·Ö·½±ã,¹ý³ÌÈçÏÂ:
Create PROCEDURE [dbo].[pt_AspNetPager]
(
@tableName varchar(255), -- ±íÃû
@fieldName varchar(400)= '*', -- ×Ö¶ÎÃû
@strWhere varchar(255) = Null,
@fieldOrder varchar(100), --²»ÄÜΪ¿Õ
@startIndex int,
@endIndex int
)
AS
declare @strSQL varchar(4000)
begin
set @strSQL='WITH temp AS (SELECT ROW_NUMBER() OVER (ORDER BY '+@fieldOrder+') as row,'+@fieldName+' from '+@tableName
if @strWhere<>''
SELECT @strSQL=@strSQL+' where '+@strWhere
SELECT @strSQL=@strSQL+')'
SELECT @strSQL=@strSQL+' SELECT * from temp where row between '+cast(@startIndex as varchar(10))+' and '+cast(@endIndex as varchar(10))
print @strSQL
exec (@strSQL)
END


Ïà¹ØÎĵµ£º

MS SQL Server2000 ÔÚtomcatϵÄÊý¾ÝÔ´ÅäÖÃ

MS SQL Server2000 Êý¾ÝÔ´ÅäÖÃ
£¨×¢£ºsqljdbc.jarÏÂÔØ²»µ½µÄ»°£¬ÕÒÎÒË÷È¡pengqinghui110@126.com)
1¡¢ÔÚÏîÄ¿µÄWebRootϵÄMETA-INFÖÐн¨context.xmlÎļþ¡£ÄÚÈÝÈçÏ£º
<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Resource name="jdbc/sqlserver"
   &nbs ......

ASP.NET SQL ×¢ÈëÃâ·Ñ½â¾ö·½°¸

 UrlScanµÄ3.1ÊÇÒ»¸ö°²È«µÄ¹¤¾ß£¬ÏÞÖÆÁËIISµÄHTTPÇëÇ󽫴¦ÀíÀàÐÍ¡£ ͨ¹ý×èÖ¹ÌØ¶¨µÄHTTPÇëÇó£¬ÔÚURLScan 3.1°²È«¹¤¾ßÓÐÖúÓÚ·ÀÖ¹¶Ô·þÎñÆ÷Ó¦ÓóÌÐò¿ÉÄÜÓꦵÄÇëÇó¡£  UrlScanµÄ3.1ÊÇURLScan 2.5µÄ¸üа汾¡£Ö§³ÖIIS 5.1ÖУ¬IIS 6.0ºÍIIS 7.0ÔÚWindows VistaºÍWindows Server 2008¡£ÏÂÔØµØÖ·http://download.csdn.net ......

SQLÄ£ºý²éѯÓï¾äºÍEscapeתÒå×Ö·û

SQLÄ£ºý²éѯÓï¾äºÍEscapeתÒå×Ö·û(2008-09-22 14:26:01)
±êÇ©£ºfrom ×ªÒå×Ö·û sql µ¥ÒýºÅ Í¨Åä·û escape it  
ͨÅä·ûÃèÊöʾÀý%°üº¬Áã¸ö»ò¸ü¶à×Ö·ûµÄÈÎÒâ×Ö·û´®¡£WHERE title LIKE '%computer%' ½«²éÕÒ´¦ÓÚÊéÃûÈÎÒâλÖõİüº¬µ¥´Ê computer µ ......

SQLµÄÈýÖÖ·ÖÒ³·½·¨

±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º 
SELECT TOP Ò³¼Ç¼ÊýÁ¿ *
from ±íÃû
WHERE (ID NOT IN
  (SELECT TOP (ÿҳÐÐÊý*(Ò³Êý-1)) ID
  from ±íÃû
  ORDER BY ID))
  ORDER BY ID
//×Ô¼º»¹¿ÉÒÔ¼ÓÉÏһЩ²éѯ ......

Çë½ÌÒ»¸ösql²éѯÎÊÌâ ×Ó²éѯ=ÏÔʾµÚ¶þÌõÐÅÏ¢

create database test --½¨Á¢testÊý¾Ý¿â
use test
create table BONUS --½¨Á¢
(
ENAME NVARCHAR(10),
JOB NVARCHAR(9),
SAL FLOAT,
COMM FLOAT
)
create table DEPT --½¨Á¢²¿Ãűí
(
DEPTNO SMALLINT not null, --²¿ÃűàºÅ
DNAME NVARCHAR(14), --²¿ÃÅÃû
LOC NVARC ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ