sqlÓï¾äµÄʹÓÃ
ÒÔÏÂÊÇÎÒÔÚѧϰÖеĵãµÎ¼Ç¼£¬Èç¹ûÓдíÎóµÄµØ·½»òÕßȱÉÙ²¿·Ö£¬Çë¸÷λ´óÏÀ²»ÁßÖ¸½Ì¡£Ð¡µÜÔÚ´Ëл¹ýÁË
1.select count£¨*£© ºÍselect count£¨id£© Ö®¼äµÄÇø±ð¡£
select count(*) ͳ¼ÆËùÓмǼ¸öÊý£¬°üÀ¨¿Õ¼Ç¼¡£
Select count(Id) ͳ¼ÆËùÓмǼ¸öÊý£¬²»°üÀ¨null¼Ç¼¡£
2.delete & truncate µÄÇø±ð
truncate
ʹÓ÷½·¨£º
¡¡ ¡¡truncate table table_name£»
¡¡ ¡¡²Ù×÷ÌØÐÔ£º
¡¡ ¡¡truncate ֻɾ³ý±íÖеÄËùÓÐÊý¾Ý£¬²»É¾³ý±íµÄ½á¹¹£»
¡¡ ¡¡truncate ÊÇddl²Ù×÷Á¢¼´ÉúЧ£¬ÔÊý¾Ý²»·Åµ½rollback segmentÖУ¬²»Äܻعö.£¬²Ù×÷²»´¥·¢trigger.£»
delete ¶ÔÿÌõ¼Ç¼µÄɾ³ý¾ùÐèÒª¼Ç¼ÈÕÖ¾
Ïà¹ØÎĵµ£º
/*
PL/SQL±í---table()º¯ÊýÓ÷¨£º
ÀûÓÃtable()º¯Êý£¬ÎÒÃÇ¿ÉÒÔ½«PL/SQL·µ»ØµÄ½á¹û¼¯´úÌætable¡£
oracleÄÚ´æ±íÔÚ²éѯºÍ±¨±íµÄʱºòÓõıȽ϶࣬ËüµÄËÙ¶ÈÏà¶ÔÎïÀí±íÒª¿ì¼¸Ê®±¶¡£
simple example£º
1¡¢table()½áºÏÊý×飺
*/
create or replace type t_test as object(
id integer,
rq date,
mc varchar2(60)
);
cr ......
SQL Server .NET Framework Êý¾ÝÌṩ³ÌÐò (SqlClient) Ìṩ¾ÛºÏº¯Êý¡£¾ÛºÏº¯Êý¶ÔÒ»×éÊäÈëÖµÖ´ÐмÆËã²¢·µ»ØÒ»¸öÖµ¡£ÕâЩº¯ÊýλÓÚ SqlServer ÃüÃû¿Õ¼äÖУ¬¸ÃÃüÃû¿Õ¼äÔÚÄúʹÓà SqlClient ʱ¿ÉÓá£Ìṩ³ÌÐòµÄÃüÃû¿Õ¼äÊôÐÔʹʵÌå¿ò¼Ü¿ÉÒÔÈ·¶¨´ËÌṩ³ÌÐò¶ÔÌض¨¹¹Ô죨ÈçÀàÐͺͺ¯Êý£©Ê¹ÓÃÄĸöǰ׺¡£
ϱíÏÔʾ SqlClient ¾ÛºÏº¯Êý¡£ ......
½ñÌìÓÖ¿´µ½Ð¼ÓƵÄͬÊ·¢¹ýÀ´µÄÒ»¶ÎSQLÓï¾ä£¬»¹ÊÇÀÏÎÊÌ⣬ʱ¼ä¶Ô±ÈÖ±½ÓÓôóÓÚСÓںš£Ì¾ÁËÉùÆøºó£¬ÊÖ¶¯¸ø¸Ä³ÉdatediffÁË£¬¿ÉÊÇÒ»ÔËÐгö´í£¬´íÎóÌáʾÈçÏ£º
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting datetime from character string.
ΪÁË˵Ã÷·½±ã£¬ÕâÀï¾Í¼ò»¯Ò»¸öÀý×ÓºÃÁË¡£
create tab ......
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLEµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£ ......