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

sql serverÖÐ×Ö·û´®ÀàÐ͵ÄÈÕÆÚÈçºÎ±È½Ï´óС

Èç¹ûÔÚÊý¾Ý¿â£¨sql£©Öн«±£´æÈÕÆÚµÄ×ֶεÄÊý¾ÝÀàÐÍÉèÖÃΪvarchar£¬¶øÄãÓÖÐèÒª¶ÔÕâ¸öÈÕÆÚºÍÁíÍâÒ»¸öÈÕÆÚ½øÐбȽϣ¬ÄÇô¸ÃÔõô°ìÄØ£¿
1. µÚÒ»ÖÖ·½·¨ºÜÈÝÒ×Ïëµ½£¬¾ÍÊÇ´¿´âµØÀûÓÃ×Ö·û´®À´±È½Ï´óС£¬±ÈÈçÓÐÒ»¸ö×Ö¶ÎΪadddate,ÆäÊý¾ÝÀàÐÍΪvarchar£¬Òª±È½ÏÕâ¸öÈÕÆÚÊDz»ÊÇ´óÓÚij¸öÈÕÆÚ£¬±ÈÈç"2006-12-23",ÄÇô¿ÉÒÔÖ±½Óд£º
where adddate>'2006-12-23'£¬ÕâÖз½·¨ºÜÖ±¹Û£¬µ±È»Ò²ÐèÒªÔÚ¸ñʽÉÏÓÐËù¹æ·¶£¬±ÈÈ磬Èç¹ûÈÕÆÚÊÇ2006Äê3ÔÂ3ÈÕ£¬¾Í±ØÐ뽫ÈÕÆÚ±£´æΪ2006-03-03£¬·ñÔò±È½ÏµÄʱºòÈÝÒ׳ö´í¡£
2. µÚ¶þÖÖ·½·¨Ôò¿ÉÒÔÀûÓÃsqlÌṩµÄÈÕÆÚת»»º¯ÊýÁË¡£
CONVERT (<data_ type>[ length ]£¬ <expression> [£¬ style])
1£©data_typeΪSQL Serverϵͳ¶¨ÒåµÄÊý¾ÝÀàÐÍ£¬Óû§×Ô¶¨ÒåµÄÊý¾ÝÀàÐͲ»ÄÜÔÚ´ËʹÓá£
2£©lengthÓÃÓÚÖ¸¶¨Êý¾ÝµÄ³¤¶È£¬È±Ê¡ÖµÎª30¡£
3£©ÓÃCONVERT£¨£© º¯ÊýµÄstyle Ñ¡ÏîÄÜÒÔ²»Í¬µÄ¸ñʽÏÔʾÈÕÆÚºÍʱ¼ä¡£style Êǽ«DATATIME ºÍSMALLDATETIME Êý¾Ýת»»Îª×Ö·û´®Ê±ËùÑ¡ÓõÄÓÉSQL Server ϵͳÌṩµÄת»»Ñùʽ±àºÅ£¬²»Í¬µÄÑùʽ±àºÅÓв»Í¬µÄÊä³ö¸ñʽ¡£
Èç¹ûÓÃÕâÖÖ·½·¨À´ÅжÏijһ¸ö×ֶεĻ°£¬Ôò´æÈëµÄÈÕÆÚ×ֶεÄ×Ö·û´®¸ñʽֻҪÊÇÄÜÈÃsql serverÍê³É¶ÔÈÕÆÚµÄת»»¾Í¿ÉÒÔÁË£¬¶ø²»Ò»¶¨ÒªÏñµÚÒ»ÖÖ·½·¨ÖеÄÄÇÑùÑϸñ¡£
»¹ÊÇ˵adddate×ֶΣ¬±ÈÈçÒª±È½ÏËüÊÇ·ñ´óÓÚµ±Ç°µÄÈÕÆÚ£¬¾Í¿ÉÒÔÕâÑùд£º
where (CONVERT(varchar, adddate) >= CONVERT(varchar, GETDATE()))


Ïà¹ØÎĵµ£º

Asp.netÓëSQLÒ»Æð´ò°ü²¿Êð°²×°


Õû¸öSQLºÍAsp.net(vb.net)Ò»Æð´ò°üµÄÈ«¹ý³ÌдһÏ¡£
Ò».×¼±¸±ØÒªµÄÎļþ
1. SQL½Å±¾Îļþ£¬Éú³ÉÒÔºó°²×°¹ý³ÌÖÐÐèÒªµÄ±íºÍ´æ´¢¹ý³ÌµÈµÈ£»
Éú³ÉÖ®ºó£¬¾ÍÔÝʱ°ÑËüÃüÃûΪdb.sql(×¢Òâ´óСд)
2.LisenceFile.rtfµÄ°²×°Îļþ£¬ÒòΪÎÒµÄϵͳÊǸöÈ˵ģ¬¶øÇÒfreeµÄ£¬ËùÒÔ¾ÍûÓÐ×ö¡£Õâ¸öÒÔºóÒ²ÊÇÒªÓõ½µÄ¡£
¶þ.ÔÚ×Ô¼ºÏÖÓеÄÏîÄ¿Àïà ......

Sqlº¯Êý´óÈ«

---·µ»Ø±í´ïʽÖÐÖ¸¶¨×Ö·ûµÄ¿ªÊ¼Î»ÖÃ
select charindex('c','abcdefg',1)
---Á½¸ö×Ö·ûµÄÖµÖ®²î
select difference('bet','bit')
---×Ö·û×î×ó²àÖ¸¶¨ÊýÄ¿
select left('abcdef',3)
---·µ»Ø×Ö·ûÊý
select len('abcdefg')
--ת»»ÎªÐ¡×Ö·û
select lower('ABCDEFG')
--È¥×ó¿Õ¸ñºó
select ltrim('   &nbs ......

SQL SERVERÄÚÖú¯Êý


¾ÛºÏº¯ÊýÈôÒª»ã×ÜÒ»¶¨·¶Î§µÄÊýÖµ£¬ÇëʹÓÃÒÔϺ¯Êý£º
SUM
·µ»Ø±í´ïʽÖÐËùÓÐÖµµÄ×ܺ͡£
Óï·¨
SUM(aggregate)
SUM Ö»ÄÜÓë°üº¬ÊýÖµµÄ×Ö¶ÎÒ»ÆðʹÓ᣽«ºöÂÔ¿ÕÖµ¡£
AVERAGE
·µ»Ø±í´ïʽÖÐËùÓзǿÕÖµµÄƽ¾ùÖµ£¨ËãÊõƽ¾ùÖµ£©¡£
Óï·¨
AVERAGE(aggregate)
AVERAGE Ö»ÄÜÓë°üº¬ÊýÖµµÄ×Ö¶ÎÒ»ÆðʹÓ᣽«ºöÂÔ¿ÕÖµ¡£
......

[¼Ç¼]ÔÚÃüÁîÐÐÖÐÆô¶¯ SQL SERVER

Æô¶¯ MS SQL SERVER £¨2000 £­2008¶¼ÊÊÓã©£º
cmd>net start mssqlserver
Æô¶¯ ·ÇȱʡʵÀý£º
cmd>net start mssql$[instance name]
×¢£ºÃüÁîÐÐÐèÒªÓÐAdministratorȨÏÞ¡£
Í£Ö¹SQLSERVER ·þÎñÆ÷:
cmd>net stop mssqlserver
cmd>net stop mssql$[instance name] ......

SQLÖÐisnullº¯ÊýµÄÓ÷¨

Óï·¨£º
   isnull(check_expression,replacement_expression)
²ÎÊýcheck_expressionÓëreplacement_expressionÀàÐÍÐèÏàͬ
·µ»ØÖµ£º
   Èôcheck_expressionΪnull£¬Ôò·µ»Øreplacement_expression
   Èôcheck_expression²»Îªnull£¬Ôò·µ»Øcheck_expression ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ