SQLÖÐsaµÇ¼ʧ°Ü
MS-SQLÖÐsaµÇ¼ʧ°Ü:
¸Ã´íÎó²úÉúµÄÔÒòÊÇÓÉÓÚSQL ServerʹÓÃÁË"½ö Windows"µÄÉí·ÝÑéÖ¤·½Ê½,
Òò´ËÓû§ÎÞ·¨Ê¹ÓÃSQL ServerµÄµÇ¼ÕÊ»§£¨Èç sa £©½øÐÐÁ¬½Ó.½â¾ö·½·¨ÈçÏÂËùʾ:
1.ÔÚ·þÎñÆ÷¶ËʹÓÃÆóÒµ¹ÜÀíÆ÷,²¢ÇÒÑ¡Ôñ"ʹÓà Windows Éí·ÝÑéÖ¤"Á¬½ÓÉÏ SQL Server
²Ù×÷²½Öè:
ÔÚÆóÒµ¹ÜÀíÆ÷ÖÐ
--ÓÒ¼üÄãµÄ·þÎñÆ÷ʵÀý(¾ÍÊÇÄǸöÓÐÂÌɫͼ±êµÄ)
--±à¼SQL Server×¢²áÊôÐÔ
--Ñ¡Ôñ"ʹÓÃwindowsÉí·ÝÑéÖ¤"
--Ñ¡Ôñ"ʹÓÃSQL ServerÉí·ÝÑéÖ¤"
--µÇ¼ÃûÊäÈë:sa,ÃÜÂëÊäÈësaµÄÃÜÂë
--È·¶¨
2.ÉèÖÃÔÊÐíSQL ServerÉí·ÝµÇ¼
²Ù×÷²½Öè:
ÔÚÆóÒµ¹ÜÀíÆ÷ÖÐ
--Õ¹¿ª"SQL Server×é",Êó±êÓÒ¼üµã»÷SQL Server·þÎñÆ÷µÄÃû³Æ
--Ñ¡Ôñ"ÊôÐÔ"
--ÔÙÑ¡Ôñ"°²È«ÐÔ"Ñ¡Ï
--ÔÚ"Éí·ÝÑéÖ¤"ÏÂ,Ñ¡Ôñ"SQL ServerºÍ Windows ".
--È·¶¨,²¢ÖØÐÂÆô¶¯SQL Server·þÎñ.
ÔÚÒÔÉϽâ¾ö·½·¨ÖÐ,Èç¹ûÔÚµÚ 1 ²½ÖÐʹÓÃ"ʹÓà Windows Éí·ÝÑéÖ¤"Á¬½Ó SQL Server ʧ°Ü,
ÄǾÍͨ¹ýÐÞ¸Ä×¢²á±íÀ´½â¾ö´ËÎÊÌâ:
1.µã»÷"¿ªÊ¼"-"ÔËÐÐ",ÊäÈëregedit,»Ø³µ½øÈë×¢²á±í±à¼Æ÷
2.ÒÀ´ÎÕ¹¿ª×¢²á±íÏî,ä¯ÀÀµ½ÒÔÏÂ×¢²á±í¼ü:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer]
3.ÔÚÆÁÄ»ÓÒ·½ÕÒµ½Ãû³Æ"LoginMode",Ë«»÷±à¼Ë«×Ö½ÚÖµ
4.½«ÔÖµ´Ó1¸ÄΪ2,µã»÷"È·¶¨"
5.¹Ø±Õ×¢²á±í±à¼Æ÷
6.ÖØÐÂÆô¶¯SQL Server·þÎñ.
´Ëʱ,Óû§¿ÉÒԳɹ¦µØʹÓÃsaÔÚÆóÒµ¹ÜÀíÆ÷ÖÐн¨SQL Server×¢²á,
µ«ÊÇÈÔÈ»ÎÞ·¨Ê¹ÓÃWindowsÉí·ÝÑé֤ģʽÀ´Á¬½ÓSQL Server.
ÕâÊÇÒòΪÔÚ SQL Server ÖÐÓÐÁ½¸öȱʡµÄµÇ¼ÕÊ»§:
BUILTIN\Administrators
<»úÆ÷Ãû>\Administrator ±»É¾³ý.
Òª»Ö¸´ÕâÁ½¸öÕÊ»§,¿ÉÒÔʹÓÃÒÔϵķ½·¨:
1.´ò¿ªÆóÒµ¹ÜÀíÆ÷,Õ¹¿ª·þÎñÆ÷×é,È»ºóÕ¹¿ª·þÎñÆ÷
2.Õ¹¿ª"°²È«ÐÔ",ÓÒ»÷"µÇ¼",È»ºóµ¥»÷"н¨µÇ¼"
3.ÔÚ"Ãû³Æ"¿òÖÐ,ÊäÈë BUILTIN\Administrators
4.ÔÚ"·þÎñÆ÷½ÇÉ«"Ñ¡ÏÖÐ,Ñ¡Ôñ"System Administrators"
5.µã»÷"È·¶¨"Í˳ö
6.ʹÓÃͬÑù·½·¨Ìí¼Ó <»úÆ÷Ãû>\Administrator µÇ¼.
˵Ã÷:
ÒÔÏÂ×¢²á±í¼ü:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\LoginMode
µÄÖµ¾ö¶¨ÁËSQL Server½«²ÉÈ¡ºÎÖÖÉí·ÝÑé֤ģʽ.
1.±íʾʹÓÃ"Windows Éí·ÝÑéÖ¤"ģʽ
2.±íʾʹÓûìºÏģʽ£¨Windows Éí·ÝÑéÖ¤ºÍ 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 t ......
±í:TABLEA
¿Í»§±àºÅ Ó¦ÊÕ½ð¶î ÊÕ¿î½ð¶î
1001 100 80
1001 200 180&nb ......
1. Èç¹ûÄãÏ£ÍûʹÓÃselcet topÓï¾ä£¬²¢ÇÒ»¹Òª¸½´øwhereÌõ¼þ£¬ÄÇôÌõ¼þÖеÄÁо͵ÃÊǺÏÊʵÄË÷Òý£¬Èç¾Û¼¯Ë÷Òý¡¢¸´ºÏË÷ÒýÀïµÄÖ÷ÁÐ
µÈ£¬Í¬Ê±£¬whereÌõ¼þÀïÒ²Òª¾¡Á¿±Ü¿ªÊ¹Óú¯Êý£¬or£¬ÅжÏNULLµÈ»áÒýÆðÈ«²¿É¨ÃèµÄÓï¾ä£¬²»È»Ö´ÐеÄÊÇÈ«±íɨÃè¡£
2. ͨ¹ýÉèÖÃSTATISTICSÎÒÃÇ¿ÉÒԲ鿴ִÐÐSQLʱµÄÖ´ÐÐЧÂÊÒÔ¼°Ïà¹ØÐÔÄܲâÊÔ ......
declare @id varchar(10)
declare @nm varchar(10)
declare @table as table(emp varchar(10),empname varchar(10))
declare CurEmp cursor for select top 6 empid,empname from employee
open CurEmp
fetch next from CurEmp into @id,@nm
While @@fetch_status=0
begin
insert @table(emp,e ......
ÎÊÌâÒ»¡¢Íü¼ÇÁ˵ǼMicrosoft SQL Server 2005 µÄsaµÄµÇ¼ÃÜÂë
½â¾ö·½·¨£ºÏÈÓÃwindowsÉí·ÝÑéÖ¤µÄ·½Ê½µÇ¼½øÈ¥£¬È»ºóÔÚ‘°²È«ÐÔ’-‘µÇ¼’-ÓÒ¼üµ¥»÷‘sa’-‘ÊôÐÔ’£¬ÐÞ¸ÄÃÜÂëµã»÷È·¶¨¾Í¿ÉÒÔÁË¡£
ÎÊÌâ¶þ¡¢Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼ¹ý³ÌÖз¢Éú´íÈ¡¡££¨provider:¹ ......