_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
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

瑚 覈旧朱 る 蠏碁 觜讌 蟆企. 讌襷 蠏碁ゼ 覩碁 螳ロ 覈旧朱 覦朱慨 蠏碁覃 蠏碁 襷襦 蠏碁 蟆企. (蟯危)