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

Ò»¸ösql·ÖÒ³µÄ´æ´¢¹ý³Ì

 CREATE  procedure SqlPager_Ex
 @sqlstr varchar(8000), --²éѯ×Ö·û´®
  @currentpage int, --µÚNÒ³
  @pagesize int --ÿҳÐÐÊý, 
 as
  set nocount on
  declare @P1 int, --P1ÊÇÓαêµÄid
   @rowcount int
  exec sp_cursoropen @P1 output,@sqlstr,@scrollopt=1,@ccopt=1,@rowcount=@rowcount output
  select  ceiling(1.0*@rowcount /@pagesize)  as ×ÜÒ³Êý --,@rowcount as ×ÜÐÐÊý,@currentpage as µ±Ç°Ò³  
  set @currentpage=(@currentpage-1)*@pagesize+1
  exec sp_cursorfetch @P1,16,@currentpage,@pagesize
  exec sp_cursorclose @P1
  set nocount off
GO


Ïà¹ØÎĵµ£º

±Ø±¸sqlÓï¾ä

 1.¶Á³ö±íÖеÄ×Ö¶ÎÃû
ResultSet  rs = test.selectSql("SELECT * from datainfo");  
java.sql.ResultSetMetaData md=rs.getMetaData();   //¶Á³öÊý¾Ý¿âµÄ×Ö¶ÎÃû
   int nColumn=md.getColumnCount();   //×Ö¶Î×ÜÊý
   for(int i=0;i<nColumn;i++)
& ......

Ô¶³Ì±¸·ÝsqlÊý¾Ý¿âµ½±¾»ú

 Ìõ¼þ£º
    ÓµÓÐsaȨÏÞ
    ¿ªÆô xp_cmdshell
·½·¨£º
 ¿ªÆô/¹Ø±Õ xp_cmdshell ±ØÐëÔÚ master  ¿âÖ´ÐÐ
EXEC sp_configure 'show advanced options', 1 
RECONFIGURE WITH OVERRIDE 
EXEC sp_configure 'xp_cmdshell', 1 
RECONFIGURE ......

sql 2005 ·ÖÒ³£¬ÅÅÃûº¯Êý

 WITH V AS(SELECT ROW_NUMBER() OVER(order by fcustid desc) AS RN,*  from  ts_dict AS SourceView)
SELECT * from V WHERE RN BETWEEN 1 AND 10
×ªÔØµØÖ·£ºhttp://www.cnblogs.com/nokiaguy/archive/2009/02/05/1384860.html
ÅÅÃûº¯ÊýÊÇSQL Server2005мӵŦÄÜ¡£ÔÚSQL Server2005ÖÐÓÐÈçÏÂËĸöÅÅÃûº ......

ÈçºÎ²é¿´SQL Server ²¹¶¡µÄ°æ±¾£¿

 Õâ¸öÌâÄ¿ÌýÆðÀ´Ê®·ÖÞÖ¿Ú£¬Ó¢ÎÄÓ¦¸ÃÕâÑùд“How to find the service pack version installed on SQL Server using”£¬Õâ¸öÎÊÌâÎÒÒ»Ö±ÔÚÕÒ£¬SQL ServerһֱûÓÐÏñÆäËûÈí¼þÒ»Ñù¿ÉÒÔÖ±½Ó²é¿´µ½°æ±¾+²¹¶¡ºÅµÄ·½·¨£¬½ñÌìµ½Ò»¸öÀÏÍâµÄÍøÕ¾ÖÕÓÚÕÒµ½ÁË£º
ÓÐÁ½ÖÖ·½·¨£º
µÚÒ»²½£ºÊ¹ÓÃSQLÓï¾ä²éѯ
select @@version ......

SQL SERVERÈÕÆÚʱ¼äº¯Êý

 À´Ô´http://hi.baidu.com/smilevt/blog/item/04bddeef0fe3f42e2cf5348b.htmlÕâÀﻹÓкܶàsql serverµÄÌû×Ó
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì
select dateadd(day,2,'2004-10-15') --·µ»Ø£º2004-10-17 00:00:00. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ