SQL Server 2000 ÖØÃüÃûÊý¾Ý¿â
ijÏîĿ֮ǰµÄÊý¾Ý¿âÓб仯£¬µ«ÊÇÒÔǰдµÄ³ÌÐòÊÇÖ§³ÖÀÏÊý¾Ý¿âµÄ£¬ÐÂÊý¾Ý¿âÓÐһЩÎÊÌ⣬ÐèÒªÐ޸쬵«ÊÇÊý¾Ý¿â¾ÍÖØ¸´ÁË£¬ÓÚÊǾÍÒª°Ñ¿ª·¢»úÉÏ֮ǰµÄÊý¾Ý¿âÖØÐÂÃüÃû¡£
ÕâÀï¼Ç¼һϲ½Ö裨¾ÉÃû³Æ£ºMobileMsg£¬ÐÂÃû³Æ£ºMobileMsg_old£©£º
1¡¢¹ØµôÆóÒµ¹ÜÀíÆ÷£¬´ò¿ª²éѯ·ÖÎöÆ÷£»
2¡¢ÐÞ¸ÄÊý¾Ý¿âÃû³Æ£º
EXEC sp_dboption 'MobileMsg', 'Single User', 'TRUE'
Go
EXEC sp_renamedb 'MobileMsg', 'MobileMsg_old'
Go
EXEC sp_dboption 'MobileMsg_old', 'Single User', 'FALSE'
Go
3¡¢ÐÞ¸ÄÐÞ¸ÄÊý¾Ý¿âµÄÂß¼Ãû³Æ£º
alter database MobileMsg_old modify file(name='MobileMsg_Data', newname='MobileMsg_old_Data')
alter database MobileMsg_old modify file(name='MobileMsg_Log', newname='MobileMsg_old_Log')
Go
4¡¢¹Ø±ÕSQL Server·þÎñ£¬ÐÞ¸ÄÎïÀíÃû³Æ£º
C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_old_Data.MDF
C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_old_Log.MDF
5¡¢ÖØÃüÃûÊý¾Ý¿âÎïÀíÎļþ£º
exec xp_cmdshell 'rename C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_Data.MDF C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_old_Data.MDF'
exec xp_cmdshell 'rename C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_Log.LDF C:\Program Files\Microsoft SQL Server\MSSQL\Data\MobileMsg_old_Log.LDF'
go
Ïà¹ØÎĵµ£º
ÔÚ°²×°SQL Server 2005¿ª·¢°æÊ±³öÏÖÎÊÌâ¡£°²×°»·¾³Îªwindows xp sp3£¬°²×°Óû§Ê¹Ó󬼶¹ÜÀíÔ±£¨Administrator£©¡£³öÏֵĴíÎóÊÇ
ÔÚ°²×°“Integration Services”²½Öèʱ³öÏÖ°²×°´íÎó£¬Ìáʾ“´íÎó: -2146233087”¡£
´íÎó¼Ç¼
±êÌâ:
Microsoft SQL Server 2005 °²×°³ÌÐò
ÎÞ·¨ÔÚ COM+ Ŀ¼Öа²×°ºÍÅäÖ ......
ÔÚVisual Studio 2008 ÖÐʹÓÃO/RÉè¼ÆÆ÷£º
µãÌí¼ÓÏîÄ¿£¬Ñ¡Ôñ´´½¨Linq to SQLÏîÄ¿£¬Ê¹Ó÷þÎñÆ÷×ÊÔ´¹ÜÀíÆ÷Á¬½ÓNorthwindÊý¾Ý¿â£¬½«CustomersºÍOrdersÁ½¸ö±íÍϵ½Éè¼Æ½çÃæÉÏ£¬ÏµÍ³»á×Ô¶¯´´½¨app.configºÍNorthwid.designer.cs,ǰÕßÊÇÅäÖÃÁ¬½ÓÊý¾Ý¿âµÄÁ¬½Ó×Ö´®£»ºóÕß»áÉú³ÉÒ»¸ö¼Ì³Ð×ÔDataContextµÄÀࣺNorthwindDataContext¡£
......
--1.¹ØÓÚwhereɸѡÆ÷ÖгöÏÖÖ¸¶¨ÐÇÆÚ¼¸µÄÇó½â
SQL code
--»·¾³
create table test_1
(
id int,
value varchar(10),
t_time datetime
)
insert test_1
select 1,'a','2009-04-19' union
select 2,'b','2009-04-20' union
select 3,'c','2009-04-21' union
select 4,'d','2009-04-22' union
s ......
×¢ÊÍ:Ö»Êʺϵ¥±íµ¥ÁÐÊý¾Ý,
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 ......
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 ......