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

¡¾×ª¡¿+¡¾Ô­¡¿SQL Server ÈÕÆÚº¯Êý£ºÄ³ÌìÊÇÐÇÆÚ¼¸

ÒªµÃµ½Ä³Ò»ÌìÊÇÐÇÆÚ¼¸£¬ÐèÒªÓõ½ SQL Server ÖеÄÈÕÆÚº¯Êý£ºdatename()¡£ ½ñÌìÊÇÐÇÆÚ¼¸£¬Àý×Ó 1£º 1: set language N'English'
2: select datename(weekday, getdate())
3: 
4: Wednesday
½ñÌìÊÇÐÇÆÚ¼¸£¬Àý×Ó 2£º

1: set language N'Simplified Chinese'
2: select datename(weekday, getdate())
3: 
4: ÐÇÆÚÈý
½ñÌìÊÇÐÇÆÚ¼¸£¬Àý×Ó 3£º

1: set datefirst 1
2: select datepart(weekday, getdate())
3: 
4: 3 -- ÐÇÆÚÈý
×¢Ò⣺ÕâÀïÓõ½ÁËÁíÍâÒ»¸ö SQL Server ÈÕÆÚº¯Êý datepart()¡£ ¡°set datefirst 1¡± ±íʾÉèÖÃÒ»ÖܵĵÚÒ»ÌìΪÐÇÆÚÒ»¡£ÔÚÀÏÃÀ£¬ËûÃǵÄÒ»ÖܵĵÚÒ»ÌìÏ°¹ßΪÐÇÆÚÌì¡£ÎÒÃÇ¿ÉÒÔͨ¹ý @@datefirst º¯ÊýµÃµ½µ±Ç°»á»°µÄ datefirst ÉèÖÃÖµ¡£

1: select @@datefirst
2: 
3: 1
Äã¿ÉÄÜÓÐÒÉÎÊ£º¡°set language¡± ºóÃæµÄÓïÑÔ²ÎÊýÊÇ´ÓÄÄÀïµÃµ½µÄ£¿¿ÉÒԵõ½ÆäËû¹ú¼ÒÓïÑÔÖеÄÐÇÆÚ¼¸Â𣿵±È»ÊÇ¿ÉÒÔµÄÁË£¬ Çë¿´ÏÂÃ棺

1: select alias, * from master..syslanguages
Èç¹ûÎÒÏëµÃµ½º«ÓïÖеÄÐÇÆÚ¼¸£¬¿ÉÒÔÕâÑù£º

1: set language N'Korean'
2: select datename(weekday, getdate())
Ô­ÎÄÁ´½Ó£ºhttp://www.sqlstudy.com/sql_article.php?id=2008071601
¡¾Ô­¡¿£ºÔÚ datefirst ±äÁ¿ÖµÎª 1ʱ£¬²»¸Ä±ädatefirst ÖµµÄÇé¿öÏ£¬¼ÆËãÐÇÆÚ¼¸µÄ·½·¨£º
      ¼ÙÉè½ñÌìÐÇÆÚÈý

1: select datepart(weekday,'2010-05-05 10:11:45.650')
     ·µ»Ø 4

1: select (datepart(weekday,getdate())+6)%8 +(datepart(weekday,getdate())+6)/8
    ·µ»Ø 3


Ïà¹ØÎĵµ£º

Ò»²½Ò»²½Ñ§Linq to sql£¨ËÄ£©£º²éѯ¾ä·¨


select
 
ÃèÊö£º²éѯ¹Ë¿ÍµÄ¹«Ë¾Ãû¡¢µØÖ·ÐÅÏ¢
²éѯ¾ä·¨£º
var ¹¹½¨ÄäÃûÀàÐÍ1 = from c in ctx.Customers
                      select new
    ......

SQL ѧϰ±Ê¼Ç ×ÔÁ¬½Ó

×ÔÁ¬½ÓÊÇÖ¸Ò»¸ö±íÓëÆä×ÔÉí½øÐÐÁ¬½Ó¡£
¾ÙÒ»¸ö¼òµ¥µÄʵÀý£¬Ò»¸öѧÉú¿Î³Ì³É¼¨±íStudentScore£¬ÆäÖаüÀ¨Ñ§Éú±àºÅ/studentid£¬ËùÑ¡¿Î³Ì/coursename,¿Î³Ì³É¼¨/score
Ñ¡ÔñÿÃſγ̵ÄÇ°Á½ÃûѧÉú,²¢½«ËûÐÅÏ¢Êä³ö³öÀ´
´ËʱÄãµÄµÚÒ»·´Ó¦¾ÍÊÇÒª°ÑѧÉú°´ËùÑ¡¿Î³Ì½øÐзÖ×飬Ȼºó±È½Ï»ñµÃÿÃſγÌÀïÃæÇ°Á½Î»µÄѧÉú
·Ö×éµÄ·½Ê½ÓÐgroup b ......

SQL ѧϰ±Ê¼Ç ¶à¹Ø¼ü×ÖÅÅÐò

ÈçºÎʵÏÖ¶à¸ö¹Ø¼ü×Ö°´ÕÕ²»Í¬ÅÅÐò¹æÔò½øÐÐÅÅÐòÄØ£¿
ORDER BY×Ó¾äÈÃÊý¾Ý¿â¶Ô²éѯ½á¹ûÅÅÐò£¬ORDER BY×Ó¾ä±ØÐë·ÅÔÚ²éѯÓï¾äµÄ½áβ¡£Æä»ù±¾ÓÃ
·¨ÈçÏ£º 
SELECT * from Contacts ORDER BY first_name; 
Äã¿ÉÒÔ¶Ô¶àÁÐÊý¾ÝÅÅÐò¡£ÓÅÏÈ˳Ðò°´´Ó×óµ½ÓÒÒÀ´Î½µµÍ£¬ËùÒÔ²éѯÓï¾äÖ ......

SQL ѧϰ±Ê¼Ç Like²Ù×÷·û

LIKE ²Ù×÷·ûÓÃÓÚÔÚ WHERE ×Ó¾äÖÐËÑË÷ÁÐÖеÄÖ¸¶¨Ä£Ê½¡£
SQL LIKE ²Ù×÷·ûÓï·¨
SELECT column_name(s) from table_name WHERE column_name LIKE pattern
SQL ͨÅä·û
ÔÚËÑË÷Êý¾Ý¿âÖеÄÊý¾Ýʱ£¬SQL ͨÅä·û¿ÉÒÔÌæ´úÒ»¸ö»ò¶à¸ö×Ö·û¡£
SQL ͨÅä·û±ØÐëÓë LIKE ÔËËã·ûÒ»ÆðʹÓá£
ÔÚ SQL ÖУ¬¿ÉʹÓÃÒÔÏÂͨÅä·û£º
ͨÅä·û
Ãè ......

SQL¶à¼¶¹ØϵµÄ±íʾ

ÎÒÃÇÒª½¨Á¢¶à¼¶¹Øϵ£¬Ê×ÏÈÐèÒªÁ½¸ö±í.
        µÚÒ»¸ö±í±íʾֱÊô½á¹¹£¬±ÈÈç˵ÎÒÃǹ«Ë¾ÓÐÒ»¸ö²¿ÃÅ¡£¶øÕâ¸ö²¿ÃÅÏ»¹ÓÐ3¸öС×飬ÄÇô3¸öС×éÊôÓÚÕâ¸ö²¿ÃÅ.µÚ¶þ¸ö±í±íʾ¶à²ã½á¹¹,¾ÍÏóµÚÒ»±íÀïÃæËù±íʾµÄ£¬ÕâÈý¸öС×éͬʱ»¹ÊôÓÚ¹«Ë¾.¶øÕâ¸ö¹«Ë¾Í¬Ê±ÊôÓÚÕâ3¸öС×éµÄ¸¸¼¶µÄ¸¸¼¶µÄ²¿ÃÅ¡£¼ÙÈçÎÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ