SQL Server 2005ÆôÓÃsaÕ˺Å
SQL Server 2005ÆôÓÃsaÕ˺Å
ÆôÓÃsaÓû§ºÍÔ¶³ÌÁ¬½Ó
²Ëµ¥Start->Microsoft SQL Server 2005->Configuration Tools->SQL Server Configuration Manager
Ñ¡ÖÐSQL Server 2005 Network Configuration
ÔÚÓұߵÄTCP/IPÉϵãÓÒ¼ü£¬enabled
²Ëµ¥Start->Microsoft SQL Server 2005->SQL Server Management Studio Express
µÇ¼¶Ô»°¿òÖ±½Óµãconnect½øÈ¥
ÔÚ×ó±ß¸ù½áµã£¨yourpcSQLEXPRESS£©ÉϵãÓÒ½¨
Ñ¡properties
×ó±ßÑ¡security£¬ÓÒ±ßÑ¡ÖÐSQL Server and Windows Authentication Mode
¹¤¾ßÀ¸µÚÒ»¸ö°´Å¥new query
ÔÚ²éѯ´°¿ÚÖÐÖ´ÐÐ
exec sp_password NULL,'yourpassword','sa'
alter login sa enable
¹Ø±ÕSQL Server Management Studio Express
²Ëµ¥Start->Microsoft SQL Server 2005->Configuration Tools->SQL Server Configuration Manager
Ñ¡ÖÐSQL Server 2005 Services
ÔÚÓұߵÄSQL Server(SQLEXPRESS)ÉϵãÓÒ¼ü£¬Restart
ÓÃsaµÇ¼
²Ëµ¥Start->Microsoft SQL Server 2005->SQL Server Management Studio Express
µÇ¼¶Ô»°¿òAuthenticationÑ¡ÔñSQL Server Authentication
µãconnect
Èç¹û²»³öÒâÍâ,Ó¦¸Ã¿ÉÒԳɹ¦µÇ¼¡£
´Ó SQL Server Management Studio ÖØÐÂÆô¶¯ SQL Server
ÔÚ¶ÔÏó×ÊÔ´¹ÜÀíÆ÷ÖУ¬ÓÒ¼üµ¥»÷ÄúµÄ·þÎñÆ÷£¬ÔÙµ¥»÷“ÖØÐÂÆô¶¯”¡£Èç¹ûÔËÐÐÓÐ SQL Server ´úÀí£¬ÔòÒ²±ØÐëÖØÐÂÆô¶¯¸Ã´úÀí¡£
ʹÓà Transact-SQL ÆôÓà sa µÇ¼ÕÊ»§
Ö´ÐÐÏÂÁÐÓï¾äÒÔÆôÓà sa ÃÜÂë²¢·ÖÅäÒ»¸öÃÜÂë¡£
¸´ÖÆ´úÂë
ALTER LOGIN sa ENABLE ;
GO
ALTER LOGIN sa WITH PASSWORD = '<password>' ;
GO
ʹÓà Management Studio ÆôÓà sa µÇ¼ÕÊ»§
ÔÚ¶ÔÏó×ÊÔ´¹ÜÀíÆ÷ÖУ¬ÒÀ´ÎÕ¹¿ª“°²È«”¡¢“µÇ¼Ãû”£¬ÓÒ¼üµ¥»÷“sa”£¬ÔÙµ¥»÷“ÊôÐÔ”¡£
ÔÚ“³£¹æ”Ò³ÉÏ£¬Äú¿ÉÄÜÐèҪΪ sa µÇ¼Ãû´´½¨ÃÜÂ벢ȷÈϸÃÃÜÂë¡£
Ôړ״̬”Ò³µÄ“µÇ¼”²¿·ÖÖУ¬µ¥»÷“ÆôÓÔ£¬È»ºóµ¥»÷“È·¶¨”¡£
Section 2
ÒªÈÃdeveloper ¿ÉÒÔͨ¹ýnetwork login µ½SQL Server 2005¾ÍÒª½øÐÐÈçÏÂcofiguration¡£
Start Menu -> Microsoft SQL Server 2005 -> Configur
Ïà¹ØÎĵµ£º
1¡¢×éºÏÓï¾äÖ´ÐÐ
BEGIN ATOMIC
±í´ïʽ1 ·ÖºÅ ¿Õ¸ñ/»Ø³µ
±í´ïʽ2 ·ÖºÅ ¿Õ¸ñ/»Ø³µ
END
2¡¢Ó¦¸ÃÏÞÖÆ·ÃÎÊȨÏÞµÄ±í£¨Ó¦¸Ã³·ÏúÕâЩ±íPUBLIC SELECT·ÃÎÊȨ£©
SYSCAT.DBAUTH
SYSCAT.TABAUTH
SYSCAT.PACKAGEAUTH
SYSCAT.INDEXAUTH
SYSCAT.COLAUTH
SYSCAT.PASSTHRUAUTH
SYSCAT.SCHEMAAUTH
±È½ÏÓÐÓõÄĿ¼± ......
SQLÓï¾äµ¼Èëµ¼³ö´óÈ«[ÊÕ¼¯]
ÕýÇÉÕâÁ½ÌìÒªÓõ½Õâ¸ö£¬ÉÏÍøÕÒµ½Ò»¸ö£¬»ØÀ´×Ô¼º¼ì²âһϣº
/******* µ¼³öµ½excel
EXEC master..xp_cmdshell 'bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -
S"GNETDATA/GNETDATA" -U"sa" -P""'
/*********** µ¼ÈëExcel
SELECT *
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
......
¸Õ¸Õ×°ÁËSQL2008£¬ÅäÖÃÁËһϣ¬ÔÚÍøÉÏÕÒµ½Õâ¸ö½Ì³Ì£¬¾õµÃ²»´í£¬×ªÔØѧϰ
1¡¢ ¸ü¸ÄTCP/IPÁ¬½ÓΪÆôÓÃ
2¡¢ µÇ¼ £¬ ÐÞ¸Ä2¸öµØ·½
a) Éí·ÝÑéÖ¤·½Ê½£¨»ìºÏģʽ£©
ͼһ£ºÊ×ÏÈʹÓÃwindowsÉí·ÝµÇ¼£¨×¢Ò⣬ ·þÎñÆ÷Ãû³Æ±ØÐëÌîдÕýÈ·£©
  ......
±¾ÖܺÍÉÏÖܾÀí¸øÎÒÃÇ×öÁËÁ½´Î¹ØÓÚsqlµÄÅàѵ£¬¸Ð¾õºÜÓÐÓÃËùÒÔ×ܽáһϣ¡
Union£ºÖ»ÓÐÁ½Õűí½á¹¹ÏàͬµÄ½á¹û¼¯²ÅÄÜʹÓÃunion£¬½«ËùÓеıíÊý¾Ý·Åµ½Ò»¸ö½á¹û¼¯ÖС£
Count£º¼ÆËã²ÎÊýÁбíÖеÄÊý×ÖÏîµÄ¸öÊý¡£À¨ºÅÀï±ß¿ÉÒÔÊÇÁÐÃû£¬Ò²¿ÉÒÔÊDzÎÊýÖµ¡£
  ......
delete from
uservalid
where(lastlogin<'2007-1-1
0:0:00')
Çå³ýÔÚuservalid±íÖÐ×îºóµÇ½ʱ¼äÔÚ2007Äê1ÔÂ1ÈÕÁãʱÁã·Ö֮ǰµÄÊý¾Ý
²éѯijһ·¶Î§ÄÚµÄÊý¾ÝÔòselete * from uservalid
where(wealth in(500,1000))
ÔÚ²éѯ·ÖÎöÆ÷ÀïÃæselete from where
inÕâЩ¹Ø¼ü×Ö¶¼×Ô¶¯´óдÁË
......