sqlserver·ÖÒ³´æ´¢¹ý³ÌµÄÓ÷¨
create proc P_QuerySplit
@sqlscript varchar(20), --±íÃû/SQLÓï¾ä
@pageSize int, --ÿҳ¼Ç¼Êý
@pageIndex int, --µ±Ç°Ò³
@totalCount int output, --×ܼǼÊý
@totalPage int output --×ÜÒ³Êý
as
declare @v_sqlscript varchar(20)
declare @v_PageSize int
declare @v_PageIndex int
declare @v_SQL_Count int
declare @v_SQL varchar(4000)
declare @v_StartIndex int
declare @v_EndIndex int
set @v_PageSize=@pageSize
--ÿҳ¼Ç¼Êý
if @v_PageSize=0
set @v_PageSize=1
print @v_pageSize
--²éѯ×ܼǼÊý
select @v_SQL_Count=count(1) from stuInfo
set @totalCount=@v_SQL_Count
print @totalCount
--×ÜÒ³Êý
set @totalPage=ceiling(@totalCount/@v_PageSize)
--µ±Ç°Ò³
if(@pageIndex=1 or @pageIndex<1)
begin
set @pageIndex=1
set @v_PageIndex=@pageIndex
set @v_StartIndex=0
set @v_EndIndex=ceiling(@v_pageIndex*@v_pageSize)
print @pageIndex
end
if @pageIndex>1
begin
set @v_PageIndex=@pageIndex
set @v_StartIndex=ceiling((@v_PageIndex-1)*@v_PageSize)
set @v_EndIndex=ceiling(@v_pageIndex*@v_pageSize)
print @pageIndex
end
set @v_sqlscript=@sqlscript
--µ±Ç°Ò³µÄ¼Ç¼
-- set @v_SQL='select top'+str(@v_PageSize)+' * from '+ @v_sqlscript+
--' where (id>(select max(id) from (select top '+str(@v_startIndex)+' id
--from '+ @v_sqlscript +' order by id) a)) order by id'
--exec (@v_SQL)
set @v_SQL='select * from (select row_number() over(order by id desc) as rownum,
* from '+@v_sqlscript+') as t where t.rownum>'+str(@v_StartIndex)+' a
Ïà¹ØÎĵµ£º
mysql ´ó¶ÔÏó´æÈ¡:
ÀàÐÍÒ»°ãÓ¦¸ÃÓÃmediumblod,
blobÖ»ÄÜ´æ2µÄ16´Î·½¸öbyte,
mediumblodÊÇ24´Î·½,
Ò»°ãÀ´Ëµ¹»ÓÃÁË.longblobÊÇ32´Î·½ÓÐЩ´ó.
MYSQLĬÈÏÅäÖÃÖ»ÄÜ´æ1M´óСµÄÎļþ,ÒªÐÞ¸ÄÅäÖÃ,WIN°æ±¾µÄÔÚmysql.iniÎļþÖÐ
ÐÞ¸Ämax_allowed_packet,net_buffer_lengthµÈ¼¸¸ö²ÎÊý,»òÖ±½ÓSET GLOBAL varName=value.
linux°æ± ......
MS Sqlserver 2005 ¼¯ÈºÊÇÖ¸Êý¾Ý¿â¸ß¿ÉÓÃÐÔ¼¯Èº£¬ÄÜʵÏÖͨ³£Ëù˵µÄ“Ë«»úÈȱ¸”£¬¼´µ±Ò»Ì¨·þÎñÆ÷Í£µôÊý¾Ý¿â·þÎñ¿ÉÒÔ×Ô¶¯×ªÒƵ½Áíһ̨·þÎñÆ÷¡£
»·¾³ÒªÇó£º
1¡¢windows 2003 serverÆóÒµ°æ
&nb ......
¡¡¡¡ÊÂʵ±í
¡¡¡¡Ã¿¸öÊý¾Ý²Ö¿â¶¼°üº¬Ò»¸ö»òÕß¶à¸öÊÂʵÊý¾Ý±í¡£ÊÂʵÊý¾Ý±í¿ÉÄܰüº¬ÒµÎñÏúÊÛÊý¾Ý£¬ÈçÏÖ½ðµÇ¼ÇÊÂÎñ
¡¡¡¡Ëù²úÉúµÄÊý¾Ý£¬ÊÂʵÊý¾Ý±íͨ³£°üº¬´óÁ¿µÄÐС£ÊÂʵÊý¾Ý±íµÄÖ÷ÒªÌØµãÊǰüº¬Êý×ÖÊý¾Ý(ÊÂʵ)£¬²¢ÇÒÕâЩÊý×ÖÐÅÏ¢¿ÉÒÔ»ã×Ü£¬ÒÔÌṩÓйص¥Î»×÷ΪÀúÊ·µÄÊý¾Ý£¬Ã¿¸öÊÂʵÊý¾Ý±í°üº¬Ò»¸öÓɶà¸ö²¿·Ö×é³ÉµÄË÷Òý£¬¸ÃË÷Òý ......
ÔÚSQL Server ÖвåÈëÒ»ÌõÊý¾ÝʹÓÃInsertÓï¾ä£¬µ«ÊÇÈç¹ûÏëÒªÅúÁ¿²åÈëÒ»¶ÑÊý¾ÝµÄ»°£¬Ñ»·Ê¹ÓÃInsert²»½öЧÂʵͣ¬¶øÇһᵼÖÂSQLһϵͳÐÔÄÜÎÊÌâ¡£ÏÂÃæ½éÉÜSQL ServerÖ§³ÖµÄÁ½ÖÖÅúÁ¿Êý¾Ý²åÈë·½·¨£ºBulkºÍ±íÖµ²ÎÊý(Table-Valued Parameters)¡£
ÔËÐÐÏÂÃæµÄ½Å±¾£¬½¨Á¢²âÊÔÊý¾Ý¿âºÍ±íÖµ²ÎÊý¡£
´úÂëÈçÏÂ:
--Create D ......
select
convert(char(4),auth,120)+'Äê'+
substring(convert(char(10),auth,120),6,2)+'ÔÂ'+
substring(convert(char(10),auth,120),9,2)+'ÈÕ',
convert(char(4),appr,120)+'Äê'+
substring(convert(char(10),appr,120),6,2)+'ÔÂ'+
substring(convert(char(10),appr,120),9,2)+'ÈÕ'
from a
ÒÔÉÏ´úÂëʵÏֵĹ¦Ä ......