SQL Server 2005 ·þÎñÆ÷½ÇÉ«ºÍÊý¾Ý¿â½ÇÉ«ÃûÈ«½â
SQL Server 2005 ·þÎñÆ÷½ÇÉ«ºÍÊý¾Ý¿â½ÇÉ«ÃûÈ«½â
/*·þÎñÆ÷½ÇÉ«*/
sysadmin
--ÔÚ SQL Server ÖнøÐÐÈκλ¡£¸Ã½ÇÉ«µÄȨÏÞ¿çÔ½ËùÓÐÆäËü¹Ì¶¨·þÎñÆ÷½ÇÉ«¡£
serveradmin
--ÅäÖ÷þÎñÆ÷·¶Î§µÄÉèÖá£
setupadmin
--Ìí¼ÓºÍɾ³ýÁ´½Ó·þÎñÆ÷£¬²¢Ö´ÐÐijЩϵͳ´æ´¢¹ý³Ì£¨Èç sp_serveroption£©¡£
securityadmin
--¹ÜÀí·þÎñÆ÷µÇ¼¡£
processadmin
--¹ÜÀíÔÚ SQL Server ʵÀýÖÐÔËÐеĽø³Ì¡£
dbcreator
--´´½¨ºÍ¸Ä±äÊý¾Ý¿â¡£
diskadmin
--¹ÜÀí´ÅÅÌÎļþ¡£
bulkadmin
--Ö´ÐÐ BULK INSERT Óï¾ä¡£
/*Êý¾Ý¿â½ÇÉ«*/
public
public ½ÇÉ«
--public ½ÇÉ«ÊÇÒ»¸öÌØÊâµÄÊý¾Ý¿â½ÇÉ«£¬Ã¿¸öÊý¾Ý¿âÓû§¶¼ÊôÓÚËü¡£public ½ÇÉ«£º
--²¶»ñÊý¾Ý¿âÖÐÓû§µÄËùÓÐĬÈÏȨÏÞ¡£
--ÎÞ·¨½«Óû§¡¢×é»ò½ÇÉ«Ö¸ÅɸøËü£¬ÒòΪĬÈÏÇé¿öÏÂËüÃǼ´ÊôÓڸýÇÉ«¡£
--º¬ÔÚÿ¸öÊý¾Ý¿âÖУ¬°üÀ¨ master¡¢msdb¡¢tempdb¡¢model ºÍËùÓÐÓû§Êý¾Ý¿â¡£
--ÎÞ·¨³ýÈ¥¡£
db_owner
--½øÐÐËùÓÐÊý¾Ý¿â½ÇÉ«µÄ»î¶¯£¬ÒÔ¼°Êý¾Ý¿âÖеÄÆäËüά»¤ºÍÅäÖû¡£
--¸Ã½ÇÉ«µÄȨÏÞ¿çÔ½ËùÓÐÆäËü¹Ì¶¨Êý¾Ý¿â½ÇÉ«¡£
db_accessadmin
--ÔÚÊý¾Ý¿âÖÐÌí¼Ó»òɾ³ý Windows NT 4.0 »ò Windows 2000 ×éºÍÓû§ÒÔ¼° SQL Server Óû§¡£
db_datareader
--²é¿´À´×ÔÊý¾Ý¿âÖÐËùÓÐÓû§±íµÄÈ«²¿Êý¾Ý¡£
db_datawriter
--Ìí¼Ó¡¢¸ü¸Ä»òɾ³ýÀ´×ÔÊý¾Ý¿âÖÐËùÓÐÓû§±íµÄÊý¾Ý
db_ddladmin
--Ìí¼Ó¡¢Ð޸Ļò³ýÈ¥Êý¾Ý¿âÖеĶÔÏó(ÔËÐÐËùÓÐ DDL)
db_securityadmin
--¹ÜÀí SQL Server 2000 Êý¾Ý¿â½ÇÉ«µÄ½ÇÉ«ºÍ³ÉÔ±£¬²¢¹ÜÀíÊý¾Ý¿âÖеÄÓï¾äºÍ¶ÔÏóȨÏÞ
db_backupoperator
--Óб¸·ÝÊý¾Ý¿âµÄȨÏÞ
db_denydatareader
--¾Ü¾øÑ¡ÔñÊý¾Ý¿âÊý¾ÝµÄȨÏÞ
db_denydatawriter
--¾Ü¾ø¸ü¸ÄÊý¾Ý¿âÊý¾ÝµÄȨÏÞ
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/shashoutian2005/archive/2008/03/29/2228272.aspx
Ïà¹ØÎĵµ£º
{
SqlConnection cnn = new SqlConnection
("context connection=true");
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "select * from customers";
SqlDataReader reader = cmd.ExecuteReader();
SqlContext.Pipe.Send(reader);
reader.Close();
cnn.Close();
}
......
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE data ......
Sql Server ²éѯsqlÖ´Ðи÷¸ö½×¶ÎµÄʱ¼ä
set statistics io on
set statistics time on
set statistics profile on
go
[ÄãµÄsqlÓï¾ä]
go
set statistics io off
set statistics time off
set statistics profile off
ÎÒÔËÐУº
set statistics io on
set statistics time on
set statistics profile on ......
×öÏîÄ¿ÀïÃæµÄÊý¾Ý¿âÉè¼ÆÁËÁ½¸öÀàÐÍ·ÅÒ»¸ö×Ö¶ÎÀïÃæ,ÎÒÓÖҪͨ¹ý·Ö¿ªµÄÀàÐÍÀ´½øÐвéѯ,Í´¿à°¡,
Á½ÖÖ·½·¨;
1,¶ÁÈ¡µ½»º´æÖÐ×Ô¶¨Òådatatable, ´úÂë¾Í²»ÌùÁË.
²»ÐÀÉÍÕâÖÖ×ö·¨,ÒòΪÎÒÒѾ°ÑÒ³ÃæÉϺܶණÎ÷дÁË,¶¼ÊÇÓеÄSqlÓï¾ä,ÕâÑù¸Äһ϶¼Òª¸ÄÁË.
2.Ö±½ÓÔÚSqlÀïÃ潨ÊÓͼ,
lÓÃSUBSTRING(dbo.K_ProductDtl.Caizhi, 0, CH ......
ÈçºÎ´´½¨ SQL Server 2005 ÐÂÕË»§£¿
Ê×ÏÈÒªÉèÖÃSQL Server 2005µÄ·ÃÎÊ·½Ê½
1´ò¿ªSQL Server Management Studio
2·þÎñÆ÷Ãû³ÆÉÏÓÒ¼üÑ¡Ôñ“ÊôÐÔ”£¬´ò¿ª“·þÎñÆ÷ÊôÐÔ”¶Ô»°¿ò£¬ÔÚ“Ñ¡ÔñÒ³”ÀïÑ¡Ôñ“°²È«ÐÔ”£¬ÔÚ“·þÎñÆ÷Éí·ÝÑéÖ¤”ÀïÑ¡Ôñ“SQL ServerºÍWindows É ......