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

SQLÖÐdeclareÉêÃ÷±äÁ¿

ÔÚsqlÓï¾äÖÐÌí¼Ó±äÁ¿¡£
declare @local_variable data_type
ÉùÃ÷ʱÐèÒªÖ¸¶¨±äÁ¿µÄÀàÐÍ£¬
¿ÉÒÔʹÓÃsetºÍselect¶Ô±äÁ¿½øÐи³Öµ£¬
ÔÚsqlÓï¾äÖоͿÉÒÔʹÓÃ@local_variableÀ´µ÷ÓñäÁ¿
ÉùÃ÷ÖпÉÒÔÌṩֵ£¬·ñÔòÉùÃ÷Ö®ºóËùÓбäÁ¿½«³õʼ»¯ÎªNULL¡£
ÀýÈ磺declare @id int
         declare @id int = 3
         set @id=2
         select id
         select @id = column_id from table where column_user = 'ABC'


Ïà¹ØÎĵµ£º

SQLÓû§È¨ÏÞ¹ÜÀí·þÎñÆ÷

Óû§È¨ÏÞ¹ÜÀí
Ò»¡¢·þÎñÆ÷µÇ¼ÕʺźÍÓû§ÕʺŹÜÀí
1.SQL Server·þÎñÆ÷µÇ¼¹ÜÀí
²»¹ÜʹÓÃÄÄÖÖÈÏ֤ģʽ£¬Óû§¶¼±ØÐëÏȾ߱¸ÓÐЧµÄÓû§µÇ¼Õʺš£SQL ServerÓÐÈý¸öĬÈϵÄÓû§µÇ¼Õʺţº¼´sa¡¢Builtin\administratorsºÍguest¡£saÊÇϵͳ¹ÜÀíÔ±(system administrator)µÄ¼ò³Æ£¬ÊÇÒ»¸öÌØÊâµÄÓû§£¬ÔÚSQL ServerϵͳºÍËùÓÐÊý¾Ý¿âÖÐÓ ......

SQL°´ÈÕÆÚÌõ¼þɾ³ýÊý¾Ý


delete from
uservalid
where(lastlogin<'2007-1-1  
0:0:00')
Çå³ýÔÚuservalid±íÖÐ×îºóµÇ½ʱ¼äÔÚ2007Äê1ÔÂ1ÈÕÁãʱÁã·Ö֮ǰµÄÊý¾Ý
²éѯijһ·¶Î§ÄÚµÄÊý¾ÝÔòselete * from uservalid
where(wealth in(500,1000))
ÔÚ²éѯ·ÖÎöÆ÷ÀïÃæselete from where
inÕâЩ¹Ø¼ü×Ö¶¼×Ô¶¯´óдÁË
......

ÅäÖÃSQL Server2005 expressÓëjdbcÁ¬½Ó

ÉÏ΢ÈíÍøÕ¾ÏÂÔØsqlserver2005 jdbc driver °ü
  
  1¡¢½«microsoft sql server 2005 jdbc driver\sqljdbc_1.2\chs\sqljdbc.jar°ü copyµ½·¢²¼ÏµÍ³ µÄ web-inf\libĿ¼ÖÐ
  2¡¢½«microsoft sql server 2005 jdbc driver\sqljdbc_1.2\chs\auth\x86\sqljdbc_auth.dll Îļþcopyµ½ windows ......

50¸ö³£ÓõÄSQLÓï¾ä

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,(sele ......

sql ³£Óú¯Êý

SQL³£ÓÃ×Ö·û´®º¯Êý
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ 255 Ö®¼ä ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ