sqlС±Ê¼Ç£¨5.26£©
sql server 2005 ¼òµ¥ÔËÓú¯Êý
1.null º¯Êý
Ó÷¨ÓëoracleÖÐnvl()ÀàËÆ£¬´¦Àíº¯ÊýΪisnull()£¬
ÀýÈ磺
select ename,sal+isnull(comm,0)
from emp
go
isnull(comm,0)µÄÓ÷¨ÊÇ£º commΪnull Ôò·µ»Ø0 ·ñÔòΪ commµÄÖµ¡£
2.Varchar ¶Ôÿ¸öÓ¢ÎÄ(ASCII)×Ö·û¶¼Õ¼ÓÃ2¸ö×Ö½Ú£¬¶ÔÒ»¸öºº×ÖÒ²Ö»Õ¼ÓÃÁ½¸ö×Ö½Ú
char ¶ÔÓ¢ÎÄ(ASCII)×Ö·ûÕ¼ÓÃ1¸ö×Ö½Ú£¬¶ÔÒ»¸öºº×ÖÕ¼ÓÃ2¸ö×Ö½Ú
Varchar µÄÀàÐͲ»ÒÔ¿Õ¸ñÌîÂú£¬±ÈÈçvarchar(100)£¬µ«ËüµÄÖµÖ»ÊÇ"qian",ÔòËüµÄÖµ¾ÍÊÇ"qian"
¶øchar ²»Ò»Ñù£¬±ÈÈçchar(100),ËüµÄÖµÊÇ"qian"£¬¶øʵ¼ÊÉÏËüÔÚÊý¾Ý¿âÖÐÊÇ"qian "(qianºó¹²ÓÐ96¸ö¿Õ¸ñ£¬¾ÍÊÇ°ÑËüÌîÂúΪ100¸ö×Ö½Ú)¡£
ÓÉÓÚcharÊÇÒԹ̶¨³¤¶ÈµÄ£¬ËùÒÔËüµÄËٶȻá±Èvarchar¿ìµÃ¶à!µ«³ÌÐò´¦ÀíÆðÀ´ÒªÂé·³Ò»µã£¬ÒªÓÃtrimÖ®ÀàµÄº¯Êý°ÑÁ½±ßµÄ¿Õ¸ñÈ¥µô!
3.Ð޸ıí½á¹¹ alter table dept add phone_number char(12)
ɾ³ýÒÔÉϵÄalter table dept drop colume phone_number
Ð޸ıíÃû sp_rename 'old_name' 'new_name' 'type'
typeÒ»°ãΪ database(¿â) object£¨±í£©column(ÁÐ) index£¨Ë÷Òý£©
ÀýÈ磺sp_rename 'sch.dept.loc' 'location' 'column' °ÑÁÐÃûloc¸ÄΪlocation
Ïà¹ØÎĵµ£º
SQL Server µÄÄ£Äâ
רÀ¸×÷¼Ò£ºDeanna Dicken 2010Äê2ÔÂ12ÈÕ
·Ò룺 UltraDBA 2010Äê5ÔÂ25ÈÕ
ÔÌûµØÖ·£ºhttp://www.databasejournal.com/features/mssql/article.php/3863516/SQL-Server-Impersonation.htm
½éÉÜ
SQL Server µÄÄ£Ä⣬»òÉÏÏÂÎÄÇл»£¬ÊÇÒ»ÖÖ·½Ê½£¬ÔÊÐíµ± ......
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
ɾ³ý±í£º
Drop table [ ......
±¾ÎÄÕÂÔ´´ÓÚwww.yafeilinux.com תÔØÇë×¢Ã÷³ö´¦¡£
SQL¼´½á¹¹»¯²éѯÓïÑÔ£¬ÊǹØϵÊý¾Ý¿âµÄ±ê×¼ÓïÑÔ¡£Ç°ÃæÒѾÌáµ½£¬ÔÚQtÖÐÀûÓÃQSqlQueryÀàʵÏÖÁËÖ´ÐÐSQLÓï¾ä¡£ÐèҪ˵Ã÷£¬ÎÒÃÇÕâÀïÖ»ÊÇQt½Ì³Ì£¬¶ø·ÇרҵµÄÊý¾Ý¿â½Ì³Ì£¬ËùÒÔÎÒÃDz»»á¶ÔÊý¾Ý¿âÖеÄһЩ֪ʶ½øÐÐÉîÈë½²½â£¬ÏÂÃæÖ»ÊǶÔ×î³£Óõļ¸¸ö֪ʶµã½øÐн²½â¡£
ÎÒÃÇÏÂÃ ......
±¾ÎÄÕÂÔ´´ÓÚwww.yafeilinux.com תÔØÇë×¢Ã÷³ö´¦¡£
½Ó×ÅÉÏһƪ½Ì³Ì¡£
¶þ£¬ÔÚSQLÓï¾äÖÐʹÓñäÁ¿¡£
ÎÒÃÇÏÈ¿´ÏÂÃæµÄÒ»¸öÀý×Ó£¬½«“²éѯ”°´Å¥µÄ²Ûº¯Êý¸ü¸ÄÈçÏ£º
void Widget::on_pushButton_clicked()
{
QSqlQuery query;
query.prepare(“insert i ......
1¡¢ ´æ´¢¹ý³Ì
1£© ¾¡Á¿½«´úÂë¶Î·Åµ½TRY…CATCH…¡£
µ«·²Ê¹ÓÃC#д¹ý´úÂëµÄÈË£¬¶¼ÖªµÀC#ÖÐTRY…CATCH…µÄÔËÐкͳö´íÌøתÂß¼£¬¶øSQL Server2005ÖУ¬ÆäÔËÐкͳö´íÌøתÂß¼ÓëÔÚC#ÖÐÊÇÒ»Öµġ£TRY…CATCH…ÊÇSQL Server2005ÖÐÐÂÔöµÄ£¬¹¦ÄÜÇ¿´ó£¬ÇҺܺÃÓá£
2£©&nb ......