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

sql server 2005 Óû§È¨ÏÞ

ÒªÏë³É¹¦·ÃÎÊ SQL Server Êý¾Ý¿âÖеÄÊý¾Ý£¬ÎÒÃÇÐèÒªÁ½¸ö·½ÃæµÄÊÚȨ£ºÒ»¡¢»ñµÃ×¼ÐíÁ¬½Ó SQL Server ·þÎñÆ÷µÄȨÀû£»¶þ¡¢»ñµÃ·ÃÎÊÌض¨Êý¾Ý¿âÖÐÊý¾ÝµÄȨÀû£¨select, update, delete, create table ...£©¡£¼ÙÉ裬ÎÒÃÇ×¼±¸½¨Á¢Ò»¸ö dba Êý¾Ý¿âÕÊ»§£¬ÓÃÀ´¹ÜÀíÊý¾Ý¿â mydb¡£
1. Ê×ÏÈÔÚ SQL Server ·þÎñÆ÷¼¶±ð£¬´´½¨µÇ½ÕÊ»§£¨create login£©
create login dba with password='sqlstudy', default_database=mydb
µÇ½ÕÊ»§ÃûΪ£º“dba”£¬µÇ½ÃÜÂ룺“sqlstudy”£¬Ä¬ÈÏÁ¬½Óµ½µÄÊý¾Ý¿â£º“mydb”¡£Õâʱºò£¬dba ÕÊ»§¾Í¿ÉÒÔÁ¬½Óµ½ SQL Server ·þÎñÆ÷ÉÏÁË¡£µ«ÊÇ´Ëʱ»¹²»ÄÜ·ÃÎÊÊý¾Ý¿âÖеĶÔÏó£¨ÑϸñµÄ˵£¬´Ëʱ dba ÕÊ»§Ä¬ÈÏÊÇ guest Êý¾Ý¿âÓû§Éí·Ý£¬¿ÉÒÔ·ÃÎÊ guest Äܹ»·ÃÎʵÄÊý¾Ý¿â¶ÔÏ󣩡£
Ҫʹ dba ÕÊ»§Äܹ»ÔÚ mydb Êý¾Ý¿âÖзÃÎÊ×Ô¼ºÐèÒªµÄ¶ÔÏó£¬ÐèÒªÔÚÊý¾Ý¿â mydb Öн¨Á¢Ò»¸ö“Êý¾Ý¿âÓû§”£¬¸³ÓèÕâ¸ö“Êý¾Ý¿âÓû§” ijЩ·ÃÎÊȨÏÞ£¬²¢ÇҰѵǽÕÊ»§“dba” ºÍÕâ¸ö“Êý¾Ý¿âÓû§” Ó³ÉäÆðÀ´¡£Ï°¹ßÉÏ£¬“Êý¾Ý¿âÓû§” µÄÃû×ÖºÍ “µÇ½ÕÊ»§”µÄÃû×ÖÏàͬ£¬¼´£º“dba”¡£´´½¨“Êý¾Ý¿âÓû§”ºÍ½¨Á¢Ó³Éä¹ØϵֻÐèÒªÒ»²½¼´¿ÉÍê³É£º
2. ´´½¨Êý¾Ý¿âÓû§£¨create user£©£º
create user dba for login dba with default_schema=dbo
²¢Ö¸¶¨Êý¾Ý¿âÓû§“dba” µÄĬÈÏ schema ÊÇ“dbo”¡£ÕâÒâζ×ÅÓû§“dba” ÔÚÖ´ÐГselect * from t”£¬Êµ¼ÊÉÏÖ´ÐеÄÊÇ “select * from dbo.t”¡£
3. ͨ¹ý¼ÓÈëÊý¾Ý¿â½ÇÉ«£¬¸³ÓèÊý¾Ý¿âÓû§“dba”ȨÏÞ£º
exec sp_addrolemember 'db_owner', 'dba'
´Ëʱ£¬dba ¾Í¿ÉÒÔȫȨ¹ÜÀíÊý¾Ý¿â mydb ÖеĶÔÏóÁË¡£
Èç¹ûÏëÈà SQL Server µÇ½ÕÊ»§“dba”·ÃÎʶà¸öÊý¾Ý¿â£¬±ÈÈç mydb2¡£¿ÉÒÔÈà sa Ö´ÐÐÏÂÃæµÄÓï¾ä£º
use mydb2
go
create user dba for login dba with default_schema=dbo
go
exec sp_addrolemember 'db_owner', 'dba'
go
´Ëʱ£¬dba ¾Í¿ÉÒÔÓÐÁ½¸öÊý¾Ý¿â mydb, mydb2 µÄ¹ÜÀíȨÏÞÁË£¡
4. ½ûÓá¢ÆôÓõǽÕÊ»§£º
alter login dba disable
alter login dba enable
5. µÇ½ÕÊ»§¸ÄÃû£º
alter login dba with name=dba_tom
Ìáʾ£ºÔÚ SQL Server 2005 ÖÐÒ²¿ÉÒÔ¸ø sa ¸ÄÃû¡£
6. µÇ½ÕÊ»§¸ÄÃÜÂ룺
alter login dba with password='sqlstudy.c


Ïà¹ØÎĵµ£º

SQL Server ÖеIJéѯ֪ͨ (ADO.NET)

²éѯ֪ͨÊÇÔÚ Microsoft SQL Server 2005 ÖÐÒÔ¼° ADO.NET 2.0 µÄ System.Data.SqlClient ÃüÃû¿Õ¼äÖÐÒýÈëµÄ¡£²éѯ֪ͨ½¨Á¢ÔÚ Service Broker »ù´¡½á¹¹µÄ»ù´¡ÉÏ£¬Ê¹Ó¦ÓóÌÐò¿ÉÒÔÔÚÊý¾Ý¸ü¸ÄʱÊÕµ½Í¨Öª¡£Èç¹ûÓ¦ÓóÌÐòÌṩÊý¾Ý¿âÖÐÐÅÏ¢µÄ»º´æ£¨ÀýÈç Web Ó¦ÓóÌÐò£©£¬ÐèÒªÔÚÔ´Êý¾Ý¸ü¸Äʱ½ÓÊÕ֪ͨ£¬´Ë¹¦ÄÜÌرðÓÐÓá£
ͨ¹ýÈýÖÖ·½Ê½ ......

SQL È¡nµ½mÌõ¼Ç¼

1.
select   top   m   *   from   tablename   where   id   not   in   (select   top   n   id   from   tablename)
2.
select   top & ......

SQL ServerÊÂÎñÈÕÖ¾½ÒÃØ

ÊÂÎñÈÕÖ¾ÀïÃ擲ؔןܶàÓÐÓõÄÐÅÏ¢¡£ËäÈ»SQL Server±¾Éí²¢Ã»ÓÐÌṩ·ÖÎö¹¤¾ß£¬µ«ÊÇÎÒÃÇ¿ÉÒÔʹÓõÚÈý·½¹¤¾ßÀ´Ò»Ì½¾¿¾¹¡£
Red GateÈí¼þÌṩÁËÒ»¿î½Ð×öSQL Log RescueµÄÃâ·Ñ¹¤¾ß£¬µ«ÊÇÖ»Ö§³ÖSQL Server 2000¡£ApexSQLºÍLumigent¹«Ë¾ÌṩµÄÁ½¿îÈí¼þ·Ö±ð½Ð×öApexSQL LogºÍLog Explorer£¬ËüÃÇÖ§³ÖSQL Server7¡¢2000ºÍ ......

SQL 2008 ½Ø¶ÏÊÂÎñÈÕÖ¾²»ÄÜÓÃÁË£¿£¿

BACKUP DATABASENAME WITH NO_LOGÒ»Ö±ÊÇÎҽضÏÊÂÎñÈÕÖ¾£¬Ñ¹Ëõ¿Õ¼äµÄÀûÆ÷£¬½ñÌìÔÙSQL2008ÉÏÒ»Óã¬È´²»ÁéÁË
ÏûÏ¢ 3032£¬¼¶±ð 16£¬×´Ì¬ 2£¬µÚ 2 ÐÐ
´ËÓï¾ä²»Ö§³ÖÒ»¸ö»ò¶à¸öÑ¡Ïî(no_log)¡£Çë²éÔÄÎĵµÒÔÁ˽âËùÖ§³ÖµÄÑ¡Ïî¡£
²é¿´Áª»ú°ïÖúÊֲᣬÀïÃæȷʵûÓÐwith no_logµÄ¿ÉÑ¡ÏîÁË£¬ÄÇÔõô°ì°¡£¬50MµÄÊý¾ÝÎļþ£¬2GµÄÈÕÖ¾Îļþ£¬È ......

³£ÓÃSQLÓï¾ä£¨Oracle£©(ת)

ORACLEÖÐ×ֶεÄÊý¾ÝÀàÐÍ
   ×Ö·ûÐÍ    char        ·¶Î§  ×î´ó2000¸ö×Ö½Ú ¶¨³¤
               char(10)   'ÕÅÈý' ºóÌí¿Õ¸ñ6¸ö°Ñ10¸ö×Ö½Ú²¹Âú  'ÕÅÈý &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ