FYI...I ran this and it seems to be working. It is still running, so not
sure if it has worked as of yet.
DECLARE @@tablename varchar(30)
DECLARE @@tablename_header varchar(75)
DECLARE @@SQLString varchar (30)
DECLARE tnames_cursor CURSOR FOR SELECT name FROM sysobjects
WHERE type = 'U'
OPEN tnames_cursor
FETCH NEXT FROM tnames_cursor INTO @@tablename
WHILE (@@FETCH_STATUS <> -1)
BEGIN
/*
Because @@FETCH_STATUS will return one of three values, -2,
-1, or 0, all three cases must be tested. In this case, if
a table has been dropped since the time this stored
procedure was executed, it will be skipped. A
successful fetch (0) will cause the 'Drop Column' within the
BEGIN..END loop to execute.
*/
IF (@@FETCH_STATUS <> -2)
BEGIN
PRINT ' '
SELECT @@tablename_header = '************** ' +
RTRIM(UPPER(@@tablename)) + ' *************'
PRINT @@tablename_header
PRINT ' '
Execute ('select msrepl_synctran_ts from ' + @@tablename)
if @@rowcount > 0
begin
exec ('alter table ' + @@tablename + ' drop column msrepl_synctran_ts')
end
END
FETCH NEXT FROM tnames_cursor INTO @@tablename
END
PRINT ' '
PRINT ' '
SELECT @@tablename_header = '************* NO MORE TABLES'
+ ' *************' PRINT @@tablename_header
PRINT ' '
PRINT 'Drop Column has been run against all user-defined tables.'
DEALLOCATE tnames_cursor
-----Original Message-----
From: Shawn Smith [mailto:[Email Address Removed] Tuesday, January 22, 2002 10:56 AM
To: 'Mssqldba Distribution List (E-mail)'
Subject: RE: Data issues
Turns out the problem is when I made the change the replication created
another column in all of the tables called....msrepl_synctran_ts. Now I need
to delete this form all the tables. How can I do this without going through
each one individually?
example:
alter (all_tables) drop column msrepl_synctran_ts
-----Original Message-----
From: Shawn Smith [mailto:[Email Address Removed] Tuesday, January 22, 2002 9:46 AM
To: Mssqldba Distribution List (E-mail)
Subject: Data issues
I switched form Snapshot replication to Transactional Replication over the
weekend. I ran out of space and had to disable replication all together
Monday. I am now getting reports form people that there is data issues.
Columns have changed and tables were dropped. Could the replication caused
this? I know in theory it should not effect any data, so it may just be a
coincidence. And if it is not how do I recover what was lost without
restoring form backup?
Shawn Smith
Database Administrator
[Email Address Removed] cell
817-667-2757 pager
---------------------------------------------------------------------
To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page