_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 覈企TableDiff覈轟企り鍵

Contents



create table #temp(rs varchar(8000))

declare 
	@str varchar(8000)
,	@i int

set @i = 1
set @str = 'cd "C:\Program Files\Microsoft SQL Server\90\COM"'
insert #temp values(@str)

-- =============================================
-- Declare and using a READ_ONLY cursor
-- =============================================
DECLARE cur CURSOR
READ_ONLY
FOR SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES

DECLARE @name varchar(40)
OPEN cur

FETCH NEXT FROM cur INTO @name
WHILE (@@fetch_status <> -1)
BEGIN
	IF (@@fetch_status <> -2)
	BEGIN
		if @i = 1
		begin
			set @str = 'tablediff -sourceserver "localhost\sql2000" -sourcedatabase "MuOnlineKor" -sourcetable "' + @name + '" -destinationserver "" -destinationdatabase "MuOnline" -destinationtable "' + @name + '" -q > c:\rs.txt'
			insert #temp values(@str)
		end else
		begin
			set @str = 'tablediff -sourceserver "localhost\sql2000" -sourcedatabase "MuOnlineKor" -sourcetable "' + @name + '" -destinationserver "" -destinationdatabase "MuOnline" -destinationtable "' + @name + '" -q >> c:\rs.txt '
			insert #temp values(@str)
		end
		--insert #temp exec master..xp_cmdshell @str

		set @i = @i + 1
	END
	FETCH NEXT FROM cur INTO @name
END

CLOSE cur
DEALLOCATE cur

select * from #temp
drop table #temp
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:52

覿 譟伎手 螳 讌 覿伎 讌螳 . 譯 殊 蠍一 朱 蟆 蠏 企 覿 レ ろ 覯襴螻 襷. 蠏碁 譯 殊 蠍一 蟆曙 企ゴ蠍郁讌 伎姶 螳讌 覿 螳危讌 螳 . 覿企 螻 覲企 覲旧企朱 企 覓 覦 襴讌 覲給 蠍一 覓願係 螳 蟆企. (伎語 "襴 語 蟇企蠍" 筝)