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

SQLÊý¾Ý¿â»Ö¸´Ä£ÐÍ(ÈÕÖ¾)

----------------------------------------------------------------------
1¡¢SQLÊý¾Ý¿â»Ö¸´Ä£ÐÍ
----------------------------------------------------------------------
1£©ÍêÈ«»Ö¸´Ä£ÐÍ
-----------------
£¨1£©±¸·ÝʱҪ±¸·ÝÊý¾Ý¿âµÄÊý¾ÝÎļþºÍÈÕÖ¾Îļþ
£¨2£©»¹Ô­Ê±Ê¹ÓÃÊý¾Ý¿âµÄ±¸·ÝµÄÊý¾ÝÎļþ¸±±¾ºÍÈ«²¿ÈÕÖ¾ÐÅÏ¢À´»Ö¸´Êý¾Ý¿â¡£
£¨3£©ÄÜ»¹Ô­È«²¿Êý¾Ý£¬²¢¿ÉÒÔ½«Êý¾Ý¿â»Ö¸´µ½ÈÎÒâÖ¸¶¨µÄʱ¿Ì¡£
£¨4£©Îª±£Ö¤ÊµÏÖ¼´Ê±µã»Ö¸´£¬¶ÔÊý¾Ý¿âµÄËùÓÐ*×÷¶¼½«ÍêÕûµØ¼ÇÈëÈÕÖ¾£¬ÕâÑù£¬ÈÕÖ¾Õ¼Óÿռä½Ï´ó£¬¶ÔÐÔÄÜÒ²ÓÐËùÓ°Ïì¡£
------------------
£¨2£©´óÈÝÁ¿ÈÕÖ¾¼Ç¼»Ö¸´Ä£ÐÍ
------------------
£¨1£©±¸·ÝʱҪ±¸·ÝÊý¾Ý¿âµÄÊý¾ÝÎļþºÍÈÕÖ¾Îļþ
£¨2£©»¹Ô­Ê±Ê¹ÓÃÊý¾Ý¿âµÄ±¸·ÝµÄÊý¾ÝÎļþ¸±±¾ºÍÈ«²¿ÈÕÖ¾ÐÅÏ¢À´»Ö¸´Êý¾Ý¿â¡£
£¨3£©ÈÕÖ¾Öв»¼Ç¼*×÷ϸ½Ú£¨Èçselect into¡¢create indexµÈ£©£¬¶øÖ»¼Ç¼*×÷µÄ×îÖÕ½á¹û£¬Òò´ËÕ¼ÓÃÈÕÖ¾¿Õ¼äС¡£
£¨4£©Ö»Ö§³Ö½«Êý¾Ý¿â»¹Ô­µ½ÊÂÎñÈÕÖ¾±¸·ÝµÄʱ¿Ì£¬¶ø²»Ö§³Ö¼´Ê±µã»Ö¸´£¬Òò´Ë¿ÉÄܲúÉúÊý¾Ý¶ªÊ§¡£
-------------------
£¨3£©¼òµ¥»Ö¸´Ä£ÐÍ
-------------------
£¨1£©±¸·Ýʱֻ±¸·ÝÊý¾ÝÎļþ£¬»¹Ô­Ê±Ò²Óñ¸·ÝµÄÊý¾ÝÎļþ»Ö¸´Êý¾Ý¿â¡£
£¨2£©Ö»Äܽ«Êý¾Ý»Ö¸´µ½Êý¾ÝÎļþ±¸·ÝµÄʱ¿Ì£¬¿ÉÄܲúÉú×î¶àµÄÊý¾Ý¶ªÊ§¡£
£¨3£©²»ÊÊÓÚÉú²úϵͳºÍ´ó¹æÄ£*×÷»·¾³ÏÂÑ¡Óá£
-----------------------------------------
alter database d1 set recovery simple--ÉèÖÃÊý¾Ý¿â»Ö¸´Ä£ÐÍ
alter database d1 set recovery bulk_logged
alter database d1 set recovery full
----------------------------------------------------------------------
ÔÚSQL ServerÖУ¬³ýÁËϵͳÊý¾Ý¿âÍ⣬Äã´´½¨µÄÿһ¸öÊý¾Ý¿â¶¼ÓÐÈýÖֿɹ©Ñ¡ÔñµÄ»Ö¸´Ä£ÐÍ: Simple(¼òµ¥), full(ÍêÕû), bulk-logged(ÅúÁ¿ÈÕÖ¾)¡£ ÏÂÃæÕâÌõÓï¾ä¿ÉÒÔÏÔʾ³öËùÓÐÔÚÏßÊý¾Ý¿âµÄ»Ö¸´Ä£ÐÍ:
SELECT name, (SELECT DATABASEPROPERTYEX(name, 'RECOVERY')) RecoveryModel from master..sysdatabases ORDER BY name
SQL Server 2005¼°ÒÔÉÏ°æ±¾Ò²¿ÉÒÔʹÓÃÏÂÃæÕâÌõÓï¾äÀ´²é¿´:
SELECT name, recovery_model_desc from master.sys.databases ORDER BY name
    Èç¹ûÏë¸Ä±äÊý¾Ý¿âµÄ»Ö¸´Ä£ÐÍ£¬¿ÉÒÔʹÓÃÏÂÃæSQLÓï¾ä:
¼òµ¥»Ö¸´Ä£ÐÍ:ALTER DATABASE AdventureWorks SET RECOVERY SIMPLE
ÍêÕû»Ö¸´Ä£ÐÍ:ALTER DATABASE AdventureWorks SET RECOVERY FULL
ÅúÁ¿ÈÕÖ¾»Ö¸´Ä£ÐÍ:ALTER DA


Ïà¹ØÎĵµ£º

.NETѧϰÊÖ¼ÇÖ®£ºlinq to SQL(Ò»)


Ò»¸ö¼òµ¥µÄÀý×Ó£º
ÏȽ¨Ò»¸öC#Àࣺ
ÒýÓÃSystem.Data.Linq.dll³ÌÐò¼¯£¬
using System.Data.Linq.MappingºÍ
using System.Data.Linq Á½¸ö¿Õ¼ä¡£
[Table]
public class Inventory
{
   [Column]
   public string Make;
   [Column]
   public string Color;
 &nbs ......

Ò»´Î²åÈë¶àÌõÐÅÏ¢(sql)

×¢ÊÍ:Ö»Êʺϵ¥±íµ¥ÁÐÊý¾Ý,
create database test
go
use test
go
create table users
(
:id int identity(1,1) primary key not null,
:name nvarchar(20)
)
go
create proc sp_Inserts
@Names nvarchar(4000)
as
declare @Name nvarchar(20),@ErrorSum int
:set @ErrorSum = 0
:begin tra ......

£Í£å£ò£ç£å SQL 2008

merge [target] t
using [source] s on t.id = s.id
when matched then update t.name = s.name, t.age = s.age -- use "rowset1"
when not matched then insert values(id,name,age) -- use "rowset2"
when source not matched then delete; -- use "rowset3"
MERGE dbo.table AS im ......

sql ¸÷ÖÖ×Ö·û´®ºÏ²¢·½·¨ µÚ¶þÖÖ·½·¨ºÃ(ÀûÓú¯Êý)

--3.3.1 ʹÓÃÓα귨½øÐÐ×Ö·û´®ºÏ²¢´¦ÀíµÄʾÀý¡£
--´¦ÀíµÄÊý¾Ý
CREATE TABLE tb(col1 varchar(10),col2 int)
INSERT tb SELECT 'a',1
UNION ALL SELECT 'a',2
UNION ALL SELECT 'b',1
UNION ALL SELECT 'b',2
UNION ALL SELECT 'b',3
--ºÏ²¢´¦Àí
--¶¨Òå½á¹û¼¯±í±äÁ¿
DECLARE @t TABLE(col1 varchar(10),col2 varch ......

³£ÓÃSQLÃæÊÔÌâ £¨Ò»£©

Êý¾Ý¿âÃæÊÔ³£ÓòâÊÔÌâ(SQL Server)
ÌâÄ¿1
¡¡¡¡ÎÊÌâÃèÊö:
¡¡¡¡Îª¹ÜÀí¸ÚλҵÎñÅàѵÐÅÏ¢£¬½¨Á¢3¸ö±í:
¡¡¡¡S (S#,SN,SD,SA) S#,SN,SD,SA ·Ö±ð´ú±íѧºÅ¡¢Ñ§Ô±ÐÕÃû¡¢ËùÊôµ¥Î»¡¢Ñ§Ô±ÄêÁä
¡¡¡¡C (C#,CN ) C#,CN ·Ö±ð´ú±í¿Î³Ì±àºÅ¡¢¿Î³ÌÃû³Æ
¡¡¡¡SC ( S#,C#,G ) S#,C#,G ·Ö±ð´ú±íѧºÅ¡¢ËùÑ¡Ð޵Ŀγ̱àºÅ¡¢Ñ§Ï°³É¼¨
¡¡¡¡1. Ê¹Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ