ÔÚEclipseÖÐÓÃJDBCÁ¬½ÓSql Server 2005×ܽá
* ×î½üÒòΪ¿ª·¢»î¶¯ÐèÒª,ÓÃÉÏÁËEclipse,²¢ÒªÇóʹÓþ«¼ò°æµÄSQL(¼´ 2005)À´½øÐпª·¢ÏîÄ¿ *
1.×¼±¸¹¤×÷: ×¼±¸Ïà¹ØµÄÈí¼þ(Eclipse³ýÍâ,¿ªÔ´Èí¼þ¿ÉÒÔ´Ó¹ÙÍøÏÂÔØ)
<1>.Microsoft 2005 Express Edition
ÏÂÔصØÖ·:http://download.microsoft.com/download/0/9/0/09020fab-d2c3-4a8c-b9e0-db53a7a30ae8/SQLEXPR_CHS.EXE
<2>. Management Studio
ÏÂÔصØÖ·:http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796#filelist
<3>. 2005 driver for JDBC
ÏÂÔصØÖ·:http://download.microsoft.com/download/8/B/D/8BDABAE2-B6EA-41D4-B903-7916EF3690EF/sqljdbc_1.2.2323.101_enu.exe
2.¶¼ÏÂÔØÍêÖ®ºó¿ªÊ¼½øÐа²×° ,Ç°Á½¸öÊÇÊôÓÚÊý¾Ý¿âÈí¼þ,Õý³£°²×°¼´¿É(×¢ÒâµÇ½²»ÒªÊ¹ÓÃwindowsÑéÖ¤)
<1> ½«JDBC½âѹËõµ½ÈÎÒâλÖÃ,±ÈÈç½âѹµ½CÅÌprogram filesÏÂÃæ,²¢ÔÚ°²×°Ä¿Â¼ÀïÕÒµ½sqljdbc.jarÎļþ,µÃµ½Æä·¾¶¿ªÊ¼ÅäÖû·¾³±äÁ¿
ÔÚ»·¾³±äÁ¿classpath ºóÃæ×·¼Ó C:\Program Files\Microsoft 2005 JDBC Driver\sqljdbc_1.2\enu\sqljdbc.jar
<2> ÉèÖÃSQLEXPRESS·þÎñÆ÷:
a.´ò¿ª Configuration Manager -> SQLEXPRESSµÄÐÒé -> TCP/IP
b.ÓÒ¼üµ¥»÷Æô¶¯TCP/IP
c.Ë«»÷½øÈë,°ÑIPµØÖ·ÖеÄIP allÖеÄTCP¶Ë¿ÚÉèÖÃΪ1433
d.ÖØÐÂÆô¶¯ 2005·þÎñÖеÄSQLEXPRESS·þÎñÆ÷
e.¹Ø±Õ Configuration Manager
<3> ´ò¿ª¸Õ¸Õ°²×°ºÃµÄ Management Studio,Á¬½ÓSQLEXPRESS·þÎñÆ÷, н¨,ÆðÃû×ÖΪsample
<4> ´ò¿ªEclipse
a.н¨¹¤³Ì-> java -> project,ÆðÃûΪTest
b.Ñ¡Ôñeclipse->´°¿Ú->Ê×Ñ¡Ïî->->installed JRE ±à¼ÒѾ°²×°ºÃµÄjdk,²éÕÒÄ¿Â
Ïà¹ØÎĵµ£º
sql Ìí¼ÓзÖÇø
ALTER PARTITION SCHEME SCH_Source_ID_DT_ID
NEXT USED sn3
go
ALTER PARTITION FUNCTION [PF_Source_ID_DT_ID]()
SPLIT RANGE ('350000')
ɾ³ý·ÖÇø
±à¼
ALTER PARTITION FUNCTION [PF_Source_ID_DT_ID]( ......
Ëø»úÖÆ
NOLOCKºÍREADPASTµÄÇø±ð¡£
1. ¿ªÆôÒ»¸öÊÂÎñÖ´ÐвåÈëÊý¾ÝµÄ²Ù×÷¡£
BEGIN TRAN t
INSERT INTO Customer
SELECT 'a','a'
2. Ö´ÐÐÒ»Ìõ²éѯÓï¾ä¡£
SELECT * from Customer WITH (NOLOCK)
½á¹ûÖÐÏÔʾ"a"ºÍ"a"¡£µ±1ÖÐÊÂÎñ»Ø¹öºó£¬ÄÇôa½«³ÉΪÔàÊý¾Ý¡£(×¢:1ÖеÄÊÂÎñδÌá½») ¡£NOLOCK±íÃ÷ûÓжÔÊý¾Ý±íÌí¼Ó¹²Ï ......
µ¼³ö±í½á¹¹:
Tools-->Export User Objects -->Ñ¡ÔñÒªµ¼³öµÄ±í(°üÀ¨SequenceµÈ)-->.sqlÎļþ
µ¼³ö±íÊý¾Ý:
Tools-->Export Tables-->Ñ¡Ôñ±í,Ñ¡ÔñSQL Inserts-->.sqlÎļþ
Ö´ÐÐÕâЩ.sqlÎļþʱ,ҪʹÓÃн¨Command WindowÀ´Ö´ÐÐ. ......
Student(S#,Sname,Sage,Ssex) ѧÉú±í
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÎÊÌ⣺
1¡¢²éѯ“001”¿Î³Ì±È“002”¿Î³Ì³É¼¨¸ßµÄËùÓÐѧÉúµÄѧºÅ£»
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
fr ......
×·¼Ó£ºrow_number, rank, dese_rank, ntile
1. row_number: Ϊ²éѯ³öÀ´µÄÿһÐмǼÉú³ÉÒ»¸öÐòºÅ¡£
SELECT row_number() OVER(ORDER BY field) AS row_n
from tablename;
·ÖÒ³²éѯ£º
with t_towtable
as (select row_number over(order by field1) as row_number from tb)
select * from t_rowtable where row_numbe ......