ÔÚ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ÖеÄand¼°orµÄÖ´ÐÐЧÂÊÎÊÌâ
£ó£ñ£ìÓï¾ä£¬ÎªÊ²Ã´°Ñ×îºóµÄ£ï£ò»»³É£á£î£ä£¬²éѯµÄ¾ÍºÜ¿ì£¬Ê¹ÓõÄÊÇmssql·¶ÀýÖÐnorthwindÊý¾Ý¿âΪÀý£¬
select * from Orders a left join [Order Details] b on a.orderid = b.orderid
where a.customerid like '%ics%' or b.productid in (42,72)
×·×ÙÁËÓï¾äµÄÖ´Ðз½°¸,·¢ÏÖ ......
µ¼³ö±í½á¹¹:
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 ......
sql server³öÏÖÑ¡¶¨µÄÓû§ÓµÓжÔÏó¶øÎÞ·¨É¾³ýµÄ´¦Àí
2006-4-5 19:50:00
·½·¨Ò»
Ê×ÏÈÄãÐèÒª×öµÄµÚÒ»¼þÊÂ
ÆóÒµ¹ÜÀíÆ÷-¡µÑ¡Ôñ·þÎñÆ÷-¡µÊô***-¡µ·þÎñÆ÷ÉèÖÃ-¡µÌôÉÏÔÊÐí¶ÔϵͳĿ¼¡£¡£¡£-¡µÈ·¶¨
µÚ¶þ²½
ÕÒµ½ÄãµÄÊý¾Ý¿âÕÒµ½sysusers±íÄÇÄãÒÔÇ°µÄÓû§É¾³ý
µÚÈý²½»ØÈ¥°ÉÊô***Öµ¸Ä»ØÀ´
µÚËIJ¿Öؽ¨Óû§¼´¿É
·½·¨¶þ
¶ ......