Showing posts with label column. Show all posts
Showing posts with label column. Show all posts

Friday, March 23, 2012

Invalid object name "MyTable" error for a StoredProcedure OleDbCommand

What doesInvalid object name "MyTable" mean?

I checked the table and column names. They are both correct.

Will the error mean something else, e.g. wrong data type, or no data?

TIA,
Jeffrey

Dim strConnAsString = ConfigurationManager.ConnectionStrings("MyConnectString").ConnectionString
Dim oConnAsNew OleDbConnection(strConn)
Dim oDBCommandAsNew OleDbCommand("MyStoredProceduret", oConn)
oDBCommand.CommandType = CommandType.StoredProcedure
oDBCommand.Connection.Open()
Dim rtnValueAsString = oDBCommand.ExecuteScalar() This is the error source file

This is the SP
CREATE PROCEDURE MyStoredProcedure AS
SELECT SettingsReqSchdTimeout FROM Settings
GO

Your query may be querying the wrong table or schema.

Try this

Dim oDBCommandAsNew OleDbCommand("[DatabaseName].[DatabaseSchemaName].MyStoredProceduret", oConn)

replace the value within []

|||

Do a search in your project for the wordMyTable, you must have a referencesomewhere in your code.

|||

You have made a spelling mistake, that could be the error, the below stored proc name has a T on the end, but your SQL doesn't.

Dim oDBCommandAsNew OleDbCommand("MyStoredProceduret", oConn)

CREATE PROCEDUREMyStoredProcedure AS
SELECT SettingsReqSchdTimeout FROM Settings
GO

|||

Thanks. What is [DatabaseSchemaName]? the dbo name?

I tried the "DatabaseName.MyStoredProcedure". The error msg is: wrong stored procedure name.

Any more suggestions? Thanks?

|||

was the name of your stored procedure just a typo in your post? it has at on the end of it. This will cause problems... won't it?Huh?

Dim oDBCommandAsNew OleDbCommand("MyStoredProceduret", oConn)

|||

'MyStoredProcedure" is not the real sp name. I just typed it to indicate a sp name.

I have checked that the real sp name is correct. Thanks.

|||

I think the problem is the database owner name. How do I cnage the database name

back to dbo? Just can not remember it.

TIA,
Jeffrey

|||

check out books online for sp_changeobjectowner

|||

I have verified that the error was due to the owner of the table is not dbo,
by creating another table with the owner as dbo.

However, I still don't know how to use sp_changeobjectowner to change
the table owner to dbo. I even tried sp_changetableowner, but didn't work.

TIA,
Jeffrey

Wednesday, March 21, 2012

Invalid identifier/column names after Upsize Access data to SQL Se

I have been asked to maintain an Access 2000 database which is a code front
end linked by ODBC to a SQL Server 2005 back end. (Originally the data was
in an Access database but was later moved to SQL Server 2005 by the Upsizing
tools.)
Some tables have column names which do not conform to the rules given in SQL
Books Online - there are field names with embedded spaces, first character
not a-z or A-Z, name contains '/' and two names which are T-SQL reserved
words. When the tables are viewed via Management Studio, these 'odd' names
are enclosed in square brackets.
The production system is working in this state, but when I try to set up a
test environment on a stand-alone PC, I cannot access these tables. If I try
to link them I get 'ODBC -- Call failed', and if I try to import them I get
error messages about various column names. I can only link to, or import
other tables which do not have these 'odd' field names. If I rename the
columns in SQL server then I can import or link them with no problem.
(My PC has the latest service packs for SQL Server 2005 and Office 2003, and
MDAC 2.8 SP1.)
Somehow the production system works with this data but my test PC doesn't.
What do I need to do on my test PC to use this data with the original 'odd'
column names?
How are you linking the tables? You can write DAO/VBA code to pass the
correctly-delimited table names.
Frankly, you'd be better off just changing the names to conform to
SQLS identifier rules. Having non-compliant names is just going to
cause more headaches down the road. Take the hit now before you've
deployed the app.
-mary
On Fri, 22 Jun 2007 07:54:04 -0700, didub
<didub@.discussions.microsoft.com> wrote:

>I have been asked to maintain an Access 2000 database which is a code front
>end linked by ODBC to a SQL Server 2005 back end. (Originally the data was
>in an Access database but was later moved to SQL Server 2005 by the Upsizing
>tools.)
>Some tables have column names which do not conform to the rules given in SQL
>Books Online - there are field names with embedded spaces, first character
>not a-z or A-Z, name contains '/' and two names which are T-SQL reserved
>words. When the tables are viewed via Management Studio, these 'odd' names
>are enclosed in square brackets.
>The production system is working in this state, but when I try to set up a
>test environment on a stand-alone PC, I cannot access these tables. If I try
>to link them I get 'ODBC -- Call failed', and if I try to import them I get
>error messages about various column names. I can only link to, or import
>other tables which do not have these 'odd' field names. If I rename the
>columns in SQL server then I can import or link them with no problem.
>(My PC has the latest service packs for SQL Server 2005 and Office 2003, and
>MDAC 2.8 SP1.)
>Somehow the production system works with this data but my test PC doesn't.
>What do I need to do on my test PC to use this data with the original 'odd'
>column names?
|||I agree that the column names should be changed to satisfy SQL naming rules,
and I plan to do that, but that is not my first priority.
This app. was created and deployed several years ago by someone who is no
longer with the company. On the live server and desktops it is working with
these invalid names.
My first objective was to install a copy of the system on my own PC so I can
take it apart and plan some major changes and bug fixes. So ideally I would
just like to get my test system working as the live system does.
My guess is that there are some ODBC related settings that I need to change.
Or perhaps there is something I need to do on the SQL Server database. I
have searched Knowledgebase and the forums but I haven't found anything
helpful yet.
"Mary Chipman [MSFT]" wrote:

> How are you linking the tables? You can write DAO/VBA code to pass the
> correctly-delimited table names.
> Frankly, you'd be better off just changing the names to conform to
> SQLS identifier rules. Having non-compliant names is just going to
> cause more headaches down the road. Take the hit now before you've
> deployed the app.
> -mary
> On Fri, 22 Jun 2007 07:54:04 -0700, didub
> <didub@.discussions.microsoft.com> wrote:
>
|||As I recommended earlier, write code so that you can specify the
delimiters. If you're using UI tools then you have no way of knowing
what the unspoken assumptions are - i.e., what is being passed to ODBC
and then the server. Another option is to put a Profiler trace on it
and see what the server is receiving from the client. It's hard to
tell from a distance what's actually going on under the covers with an
app, especially if someone else wrote it.
-mary
On Fri, 22 Jun 2007 15:09:01 -0700, didub
<didub@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>I agree that the column names should be changed to satisfy SQL naming rules,
>and I plan to do that, but that is not my first priority.
>This app. was created and deployed several years ago by someone who is no
>longer with the company. On the live server and desktops it is working with
>these invalid names.
>My first objective was to install a copy of the system on my own PC so I can
>take it apart and plan some major changes and bug fixes. So ideally I would
>just like to get my test system working as the live system does.
>My guess is that there are some ODBC related settings that I need to change.
>Or perhaps there is something I need to do on the SQL Server database. I
>have searched Knowledgebase and the forums but I haven't found anything
>helpful yet.
>
>"Mary Chipman [MSFT]" wrote:

Invalid identifier/column names after Upsize Access data to SQL Se

I have been asked to maintain an Access 2000 database which is a code front
end linked by ODBC to a SQL Server 2005 back end. (Originally the data was
in an Access database but was later moved to SQL Server 2005 by the Upsizing
tools.)
Some tables have column names which do not conform to the rules given in SQL
Books Online - there are field names with embedded spaces, first character
not a-z or A-Z, name contains '/' and two names which are T-SQL reserved
words. When the tables are viewed via Management Studio, these 'odd' names
are enclosed in square brackets.
The production system is working in this state, but when I try to set up a
test environment on a stand-alone PC, I cannot access these tables. If I try
to link them I get 'ODBC -- Call failed', and if I try to import them I get
error messages about various column names. I can only link to, or import
other tables which do not have these 'odd' field names. If I rename the
columns in SQL server then I can import or link them with no problem.
(My PC has the latest service packs for SQL Server 2005 and Office 2003, and
MDAC 2.8 SP1.)
Somehow the production system works with this data but my test PC doesn't.
What do I need to do on my test PC to use this data with the original 'odd'
column names?How are you linking the tables? You can write DAO/VBA code to pass the
correctly-delimited table names.
Frankly, you'd be better off just changing the names to conform to
SQLS identifier rules. Having non-compliant names is just going to
cause more headaches down the road. Take the hit now before you've
deployed the app.
-mary
On Fri, 22 Jun 2007 07:54:04 -0700, didub
<didub@.discussions.microsoft.com> wrote:

>I have been asked to maintain an Access 2000 database which is a code front
>end linked by ODBC to a SQL Server 2005 back end. (Originally the data was
>in an Access database but was later moved to SQL Server 2005 by the Upsizin
g
>tools.)
>Some tables have column names which do not conform to the rules given in SQ
L
>Books Online - there are field names with embedded spaces, first character
>not a-z or A-Z, name contains '/' and two names which are T-SQL reserved
>words. When the tables are viewed via Management Studio, these 'odd' names
>are enclosed in square brackets.
>The production system is working in this state, but when I try to set up a
>test environment on a stand-alone PC, I cannot access these tables. If I tr
y
>to link them I get 'ODBC -- Call failed', and if I try to import them I get
>error messages about various column names. I can only link to, or import
>other tables which do not have these 'odd' field names. If I rename the
>columns in SQL server then I can import or link them with no problem.
>(My PC has the latest service packs for SQL Server 2005 and Office 2003, an
d
>MDAC 2.8 SP1.)
>Somehow the production system works with this data but my test PC doesn't.
>What do I need to do on my test PC to use this data with the original 'odd'
>column names?sql

Monday, March 19, 2012

Invalid Cursor State - Column Rename/Move

Hi,
I am trying to rename columns or move column in a simple table that has data
in it.
Each time I am getting an "Invalid Cursor State" error message.
I am doing that all the time in Access 97/2000/2002/2003. Why is it not
working in SQL Server 2000?
Any idea?
Thanks
vbdev
OK. Forget it. Found the issue:
The Hotfix that you have to install to get the report services on your
server is causing this odd behavior.
Solution is to install Hotfix 878...
vbdev

Invalid Cursor State - Column Rename/Move

Hi,
I am trying to rename columns or move column in a simple table that has data
in it.
Each time I am getting an "Invalid Cursor State" error message.
I am doing that all the time in Access 97/2000/2002/2003. Why is it not
working in SQL Server 2000?
Any idea?
Thanks
vbdevOK. Forget it. Found the issue:
The Hotfix that you have to install to get the report services on your
server is causing this odd behavior.
Solution is to install Hotfix 878...
vbdev

Invalid Cursor State

After I create a table, if I attempt to modify or insert a column using the
wizard in EM, I get the following error:
-Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid Cursor State
I have SP3a installed, Analysis Services and SQL Reporting. Any suggestions?
Thanks.
DanSounds like this KB article.
FIX: An invalid cursor state occurs after you apply Hotfix 8.00.0859 or
later in SQL Server 2000
http://support.microsoft.com/kb/831997
However, this MS PSS only fix looks like BUILD 876. BUILD 878 is public and
located here:
http://support.microsoft.com/?kbid=838166
Since these are cumulative, it would include the fix for the other.
Sincerely,
Anthony Thomas
"DLS" <DLS@.discussions.microsoft.com> wrote in message
news:2BB9D7A0-6BCE-426F-9375-7D205280F4DA@.microsoft.com...
After I create a table, if I attempt to modify or insert a column using the
wizard in EM, I get the following error:
-Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid Cursor State
I have SP3a installed, Analysis Services and SQL Reporting. Any suggestions?
Thanks.
Dan

Invalid Cursor State

After I create a table, if I attempt to modify or insert a column using the
wizard in EM, I get the following error:
-Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid Cursor State
I have SP3a installed, Analysis Services and SQL Reporting. Any suggestions?
Thanks.
DanSounds like this KB article.
FIX: An invalid cursor state occurs after you apply Hotfix 8.00.0859 or
later in SQL Server 2000
http://support.microsoft.com/kb/831997
However, this MS PSS only fix looks like BUILD 876. BUILD 878 is public and
located here:
http://support.microsoft.com/?kbid=838166
Since these are cumulative, it would include the fix for the other.
Sincerely,
Anthony Thomas
--
"DLS" <DLS@.discussions.microsoft.com> wrote in message
news:2BB9D7A0-6BCE-426F-9375-7D205280F4DA@.microsoft.com...
After I create a table, if I attempt to modify or insert a column using the
wizard in EM, I get the following error:
-Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid Cursor State
I have SP3a installed, Analysis Services and SQL Reporting. Any suggestions?
Thanks.
Dan

Monday, March 12, 2012

Invalid Cursor State

After I create a table, if I attempt to modify or insert a column using the
wizard in EM, I get the following error:
-Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid Cursor State
I have SP3a installed, Analysis Services and SQL Reporting. Any suggestions?
Thanks.
Dan
Sounds like this KB article.
FIX: An invalid cursor state occurs after you apply Hotfix 8.00.0859 or
later in SQL Server 2000
http://support.microsoft.com/kb/831997
However, this MS PSS only fix looks like BUILD 876. BUILD 878 is public and
located here:
http://support.microsoft.com/?kbid=838166
Since these are cumulative, it would include the fix for the other.
Sincerely,
Anthony Thomas
"DLS" <DLS@.discussions.microsoft.com> wrote in message
news:2BB9D7A0-6BCE-426F-9375-7D205280F4DA@.microsoft.com...
After I create a table, if I attempt to modify or insert a column using the
wizard in EM, I get the following error:
-Unable to modify table.
ODBC error: [Microsoft][ODBC SQL Server Driver]Invalid Cursor State
I have SP3a installed, Analysis Services and SQL Reporting. Any suggestions?
Thanks.
Dan

Invalid Column?

Two things I could use help with. First one is I know there is probbaly a
way better method to do this and I would love someone to show me what it is
having just begun in the SQL trans language. The 2nd is, I am curious why,
even though its clearly not the best method, why it doesn't work and returns
an error "invalid column name 'tod' " for the line containing the 'on'
statement for the join. It looks like it should work, but doesn't...:(
tnx
select datepart(hh,a.timearrived) as TOD, count(a.calldate) as total,
b.total
from tbldatapcr a
inner join
(
select datepart(hh,timearrived) as TOD, count(calldate) as Total
from tbldatapcr
where calldate between '09/01/04' and '12/01/04'
and timearrived is not null
group by datepart(hh,timearrived)
) b
on a.tod = b.tod
where calldate between '09/01/04' and '12/01/04'
and timearrived is not null
and cdisp = 40
group by datepart(hh,a.timearrived)
order by datepart(hh,a.timearrived)You need to specify for the join
"ON a.timearrived = b.tod"
"Dave S." <davidstedman@.colliergov.net> wrote in message
news:uIVaAEnHFHA.2744@.tk2msftngp13.phx.gbl...
> Two things I could use help with. First one is I know there is probbaly a
> way better method to do this and I would love someone to show me what it
is
> having just begun in the SQL trans language. The 2nd is, I am curious why,
> even though its clearly not the best method, why it doesn't work and
returns
> an error "invalid column name 'tod' " for the line containing the 'on'
> statement for the join. It looks like it should work, but doesn't...:(
> tnx
>
> select datepart(hh,a.timearrived) as TOD, count(a.calldate) as total,
> b.total
> from tbldatapcr a
> inner join
> (
> select datepart(hh,timearrived) as TOD, count(calldate) as Total
> from tbldatapcr
> where calldate between '09/01/04' and '12/01/04'
> and timearrived is not null
> group by datepart(hh,timearrived)
> ) b
> on a.tod = b.tod
> where calldate between '09/01/04' and '12/01/04'
> and timearrived is not null
> and cdisp = 40
> group by datepart(hh,a.timearrived)
> order by datepart(hh,a.timearrived)
>
>|||If TOD doesn't exist in the table then you can't reference it unless it
exists in a derived table query. It looks like you also need to add
B.total to the outer query's GROUP BY list.
Here's a shorter (and untested) version of the query:
SELECT DATEPART(HH,timearrived) AS tod,
COUNT(calldate) AS total,
COUNT(CASE WHEN cdisp=40 THEN calldate END) AS total
FROM tbldatapcr
WHERE calldate BETWEEN '20040901' and '20041201'
AND timearrived IS NOT NULL
GROUP BY DATEPART(HH,timearrived)
Use the format I have used for date literals. Your version isn't safe
under all connection settings and may cause errors in a production
environment.
David Portas
SQL Server MVP
--|||Dave,

> Two things I could use help with. First one is I know there is probbaly a
> way better method to do this and I would love someone to show me what it i
s
> having just begun in the SQL trans language.
It is always welcome when you post DDL, sample data and expected result. As
you can see there no one piece of info about your tables, constraints, etc.
What are you trying to accomplish?
Are you looking for a guess?

> even though its clearly not the best method, why it doesn't work and retur
ns
> an error "invalid column name 'tod' " for the line containing the 'on'
> statement for the join. It looks like it should work, but doesn't...:(
There is not a column named "tod" in table "tbldatapcr". You can not use a
column alias in the WHERE clause.
...
> on a.tod = b.tod
...
should be:
...
on datepart(hh,a.timearrived) = b.tod
...
The reason you can reference "b.tod" is because "b" is a derived table.
AMB
"Dave S." wrote:

> Two things I could use help with. First one is I know there is probbaly a
> way better method to do this and I would love someone to show me what it i
s
> having just begun in the SQL trans language. The 2nd is, I am curious why,
> even though its clearly not the best method, why it doesn't work and retur
ns
> an error "invalid column name 'tod' " for the line containing the 'on'
> statement for the join. It looks like it should work, but doesn't...:(
> tnx
>
> select datepart(hh,a.timearrived) as TOD, count(a.calldate) as total,
> b.total
> from tbldatapcr a
> inner join
> (
> select datepart(hh,timearrived) as TOD, count(calldate) as Total
> from tbldatapcr
> where calldate between '09/01/04' and '12/01/04'
> and timearrived is not null
> group by datepart(hh,timearrived)
> ) b
> on a.tod = b.tod
> where calldate between '09/01/04' and '12/01/04'
> and timearrived is not null
> and cdisp = 40
> group by datepart(hh,a.timearrived)
> order by datepart(hh,a.timearrived)
>
>
>|||Sorry, forgot this part
column_alias can be used in an ORDER BY clause. However, it cannot be used
in a WHERE, GROUP BY, or HAVING clause. If the query expression is part of a
DECLARE CURSOR statement, column_alias cannot be used in the FOR UPDATE
clause.
"SW" <simon.worth@.gmail.com> wrote in message
news:%23xexMMnHFHA.1476@.TK2MSFTNGP09.phx.gbl...
> You need to specify for the join
> "ON a.timearrived = b.tod"
> "Dave S." <davidstedman@.colliergov.net> wrote in message
> news:uIVaAEnHFHA.2744@.tk2msftngp13.phx.gbl...
a
> is
why,
> returns
>|||Here is the answer.
Dynamic Search Conditions in T-SQL
http://www.sommarskog.se/dyn-search.html
AMB
"Dave S." wrote:

> Two things I could use help with. First one is I know there is probbaly a
> way better method to do this and I would love someone to show me what it i
s
> having just begun in the SQL trans language. The 2nd is, I am curious why,
> even though its clearly not the best method, why it doesn't work and retur
ns
> an error "invalid column name 'tod' " for the line containing the 'on'
> statement for the join. It looks like it should work, but doesn't...:(
> tnx
>
> select datepart(hh,a.timearrived) as TOD, count(a.calldate) as total,
> b.total
> from tbldatapcr a
> inner join
> (
> select datepart(hh,timearrived) as TOD, count(calldate) as Total
> from tbldatapcr
> where calldate between '09/01/04' and '12/01/04'
> and timearrived is not null
> group by datepart(hh,timearrived)
> ) b
> on a.tod = b.tod
> where calldate between '09/01/04' and '12/01/04'
> and timearrived is not null
> and cdisp = 40
> group by datepart(hh,a.timearrived)
> order by datepart(hh,a.timearrived)
>
>
>|||Sorry, wrong place.
AMB
"Alejandro Mesa" wrote:
> Here is the answer.
> Dynamic Search Conditions in T-SQL
> http://www.sommarskog.se/dyn-search.html
>
> AMB
> "Dave S." wrote:
>

Invalid Column Names?

Here is my code:
DECLARE curCAED1 CURSOR FAST_FORWARD FOR
SELECT * FROM okc_contr_license
WHERE CONTR_TYPE = 'ME'
ORDER BY CONTRACTOR_NUMBER
OPEN curCAED1
FETCH NEXT FROM curCAED1 INTO
@.pContrType, @.pContractorNumber,
@.pCityLicType, @.pCityLicNumber, @.pCityLicRenDate,
@.pFirstName, @.pMiddleInitial, @.pLastName
WHILE @.@.FETCH_STATUS = 0
BEGIN
UPDATE PermitsSystemNew.dbo.CAED_CONVERSION --Error generated here--
SET CAE_FName = @.pFirstName
WHERE CONTR_TYPE = @.pContrType AND CONTRACTOR_NUMBER = @.pContractorNumber
FETCH NEXT FROM curCAED1 INTO
@.pContrType, @.pContractorNumber,
@.pCityLicType, @.pCityLicNumber, @.pCityLicRenDate,
@.pFirstName, @.pMiddleInitial, @.pLastName
END
CLOSE curCAED1
DEALLOCATE curCAED1
Here is my error:
Server: Msg 207, Level 16, State 3, Line 134
Invalid column name 'CONTR_TYPE'.
Server: Msg 207, Level 16, State 1, Line 134
Invalid column name 'CONTRACTOR_NUMBER'.
What is going on? Shouldn't this work?
Thanks y'all!
DarrellI can't be too sure without the DDL, but I'll ask the question of why would
you do this update in a cursor? Also, bad idea to do SELECT * in a cursor.
"Darrell" <Darrell.Wright.nospam@.okc.gov> wrote in message
news:eQyhwdlWGHA.1220@.TK2MSFTNGP02.phx.gbl...
> Here is my code:
> DECLARE curCAED1 CURSOR FAST_FORWARD FOR
> SELECT * FROM okc_contr_license
> WHERE CONTR_TYPE = 'ME'
> ORDER BY CONTRACTOR_NUMBER
> OPEN curCAED1
> FETCH NEXT FROM curCAED1 INTO
> @.pContrType, @.pContractorNumber,
> @.pCityLicType, @.pCityLicNumber, @.pCityLicRenDate,
> @.pFirstName, @.pMiddleInitial, @.pLastName
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> UPDATE PermitsSystemNew.dbo.CAED_CONVERSION --Error generated here--
> SET CAE_FName = @.pFirstName
> WHERE CONTR_TYPE = @.pContrType AND CONTRACTOR_NUMBER =
> @.pContractorNumber
> FETCH NEXT FROM curCAED1 INTO
> @.pContrType, @.pContractorNumber,
> @.pCityLicType, @.pCityLicNumber, @.pCityLicRenDate,
> @.pFirstName, @.pMiddleInitial, @.pLastName
> END
> CLOSE curCAED1
> DEALLOCATE curCAED1
> Here is my error:
> Server: Msg 207, Level 16, State 3, Line 134
> Invalid column name 'CONTR_TYPE'.
> Server: Msg 207, Level 16, State 1, Line 134
> Invalid column name 'CONTRACTOR_NUMBER'.
> What is going on? Shouldn't this work?
> Thanks y'all!
> Darrell|||Those columns don't exist, as you've read the results of the select
query into (presumably) @.pContrType and @.pContractorNumber.
What is the WHERE clause trying to achieve?
*** Sent via Developersdex http://www.examnotes.net ***|||First. Found the problem. The fields don't exist in the table being updated
(as
noted by Anthony Brown). Doh! My mistake.
Second. There is a one-to-many relationship. One record in the table being
updated to many records in the cursor table.
Third. Normally I would agree with your SELECT * principal. However, there a
re
only 8 columns in the table I am declaring the cursor on. So, it is under co
ntrol.
Thanks for your help and insight.
David D Webb said the following on 04/07/2006 11:09 AM:
> I can't be too sure without the DDL, but I'll ask the question of why woul
d
> you do this update in a cursor? Also, bad idea to do SELECT * in a cursor
.
>
> "Darrell" <Darrell.Wright.nospam@.okc.gov> wrote in message
> news:eQyhwdlWGHA.1220@.TK2MSFTNGP02.phx.gbl...
>|||> Second. There is a one-to-many relationship. One record in the table being
> updated to many records in the cursor table.
You are effectively making the relationship 1 to 1. The only update that
"counts" will the be last one for a given contractor_number. Unfortunately,
you have made it a somewhat random 1 to 1 relationship since the cursor is
not ordered by anything other than contractor_number. You could just have
easily used an aggregate (min, max - ly, there is no
chose_any_one_i_don't_care() aggregate function), performing the update much
more quickly and efficiently with a single statement.|||HAve you tried to run the update with some values to see if it works by
itself?
E.g.
begin tran
UPDATE PermitsSystemNew.dbo.CAED_CONVERSION --Error generated here--
SET CAE_FName = [some value]
WHERE CONTR_TYPE = [some value]
AND
CONTRACTOR_NUMBER = [some value]
rollback
It looks like the table PermitsSystemNew.dbo.CAED_CONVERSION does not have
those columns...
Let em kow how it goes...
"Darrell" wrote:

> Here is my code:
> DECLARE curCAED1 CURSOR FAST_FORWARD FOR
> SELECT * FROM okc_contr_license
> WHERE CONTR_TYPE = 'ME'
> ORDER BY CONTRACTOR_NUMBER
> OPEN curCAED1
> FETCH NEXT FROM curCAED1 INTO
> @.pContrType, @.pContractorNumber,
> @.pCityLicType, @.pCityLicNumber, @.pCityLicRenDate,
> @.pFirstName, @.pMiddleInitial, @.pLastName
> WHILE @.@.FETCH_STATUS = 0
> BEGIN
> UPDATE PermitsSystemNew.dbo.CAED_CONVERSION --Error generated here--
> SET CAE_FName = @.pFirstName
> WHERE CONTR_TYPE = @.pContrType AND CONTRACTOR_NUMBER = @.pContractorNumb
er
> FETCH NEXT FROM curCAED1 INTO
> @.pContrType, @.pContractorNumber,
> @.pCityLicType, @.pCityLicNumber, @.pCityLicRenDate,
> @.pFirstName, @.pMiddleInitial, @.pLastName
> END
> CLOSE curCAED1
> DEALLOCATE curCAED1
> Here is my error:
> Server: Msg 207, Level 16, State 3, Line 134
> Invalid column name 'CONTR_TYPE'.
> Server: Msg 207, Level 16, State 1, Line 134
> Invalid column name 'CONTRACTOR_NUMBER'.
> What is going on? Shouldn't this work?
> Thanks y'all!
> Darrell
>

Invalid column name using BCP

Hi,

I am having trouble creating the data files. I received the error that there is an invalid column name 'Name' when using the BCP to create the files. How can I find out where this error is coming from?

Thanks

Quote:

Originally Posted by sarah21

Hi,

I am having trouble creating the data files. I received the error that there is an invalid column name 'Name' when using the BCP to create the files. How can I find out where this error is coming from?

Thanks


Sarah,

Name is a funny word in SQL Server as it is also a programming command and that is why you may be experiencing problems, try putting the column name in [] or change column name to be something more meaingfull like FullName.

Hope that helps

Invalid column name 'rowguiedcol' - error number 207

"The process could not deliver the snapshot to the Subscriber"
I added a new database to the same server as the publisher and distributor.
The error ocurred when pushing a new subscription to it.
I did indicate that the subscriber already has the schema and data.
Any ideas for correcting?
thanks,
bob
Sounds like the table you are replicating to has an extra column in it which
is not in the publisher. Look for a column called rowguidcol and delete it.
If you get an error message complaining that this table is published for
replication or a similar message, verify that this table is not published,
or published to.
If it is you might have to do the following:
exec sp_configure N'allow updates', 1
go
reconfigure with override
go
UPDATE syscolumns set colstat = colstat & ~4096 WHERE colstat &4096 <>0
GO
UPDATE sysobjects set replinfo=0
GO
and then issue a sp_MSunmarkreplinfo against the problem table
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Robert A. DiFrancesco" <bob.difrancesco@.comcash.com> wrote in message
news:umf1ACevEHA.2520@.TK2MSFTNGP15.phx.gbl...
> "The process could not deliver the snapshot to the Subscriber"
> I added a new database to the same server as the publisher and
distributor.
> The error ocurred when pushing a new subscription to it.
> I did indicate that the subscriber already has the schema and data.
> Any ideas for correcting?
> thanks,
> bob
>

Invalid column name 'rowguid'.

Hello ,
I scripted the creation of my Replication ,
Then droped the Replication ,
Added 1 or 2 new Fields in 5 existing tables
and then Recreated the Replication using the scripted File.
The Replication is Created Succesfully but I got an Error when running
the
Snapshot Agent
The Error Is
Invalid column name 'rowguid'.
Can Anyone Help Please
Thanks
Savvas
I set the @.keep_partition_changes = N'false' in the Create
Replication Script
then run snapshot and it worked

invalid column name 'rowguid'

Hi all,

I'm new to replication and database management so I will like some understanding and guiding as this is a new task for me.

I was given a copy of a database with merge replication on it and doing allot of reading and using some scripts I cleaned replication (or so Im thinking) and tryed to use it again on the ms-access front end. When I try to update some data I get "invalid column name 'rowguid'" , but no such column exist in my database as it was dropped.

Any help on this?

thanks George.

You refer to rowguid column either with its real column name or ROWGUIDCOL identifier. ie:

create table myTable ( pkid uniqueidentifier rowguid, othercolumn int )

select pkid, othercolumn from myTable

select ROWGUIDCOL, othercolumn from mytable

|||

When you setup merge replication, it adds a guid column to your table article. You scripts may have dropped the column when you clean up the replication and your front end may still have dependency to that column. Perhap, add a dummy column with same name and type to see if that would get your access front end to work.

Regards,

Gary

|||

As Gary mentioned most likely the column is removed when you cleaned up replication.

It is better to update your front end to not reference this non-existant column.

|||

Thanks for the replies.

The database I was given had a pull subscription on it. With the scripts it was cleared. In my access code using breakpoints I did not find any references to this columns in places where the code steps into.

The code I found and used to clean all replication (indexes, rowguid column etc.) in the database follows:

************************************

UPDATE sysobjects set replinfo=0
GO

DECLARE @.name nvarchar(129)
DECLARE list_views CURSOR FOR
SELECT name FROM sysobjects WHERE type='V' and (name
like 'syncobj_%' or name like 'ctsv_%' or name
like 'tsvw_%')

OPEN list_views

FETCH NEXT FROM list_views INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping View ' +@.name
select @.name='drop View ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_views INTO @.name
END

CLOSE list_views
DEALLOCATE list_views

GO

DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='p' and (name
like 'sp_ins_%' or name like 'sp_MSdel_%' or name
like 'sp_MSins_%'or name like 'sp_MSupd_%' or name
like 'sp_sel_%' or name like 'sp_upd_%')

OPEN list_procs

FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping procs ' +@.name
select @.name='drop procedure ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs

GO

DECLARE @.name nvarchar(129)
DECLARE list_conflict_tables CURSOR FOR
SELECT name From sysobjects WHERE type='u' and name
like '_onflict%'

OPEN list_conflict_tables

FETCH NEXT FROM list_conflict_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping conflict_tables ' +@.name
select @.name='drop Table ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_conflict_tables INTO @.name
END

CLOSE list_conflict_tables
DEALLOCATE list_conflict_tables

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_constraints CURSOR FOR
select object_name(sysobjects.parent_obj), sysobjects.name
from sysobjects, syscolumns where sysobjects.type ='d'
and syscolumns.id=sysobjects.parent_obj
and syscolumns.name='rowguid'

OPEN list_rowguid_constraints

FETCH NEXT FROM list_rowguid_constraints INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid constraints ' +@.name
select @.name='ALTER TABLE ' + rtrim(@.name ) + '
DROP CONSTRAINT ' +@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_constraints INTO
@.name, @.constraint
END

CLOSE list_rowguid_constraints
DEALLOCATE list_rowguid_constraints

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_indexes CURSOR FOR
select object_name(id), name from sysindexes where name
like 'index%'

OPEN list_rowguid_indexes

FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid indexes ' +@.name
select @.name='drop index ' + rtrim(@.name ) + '.'
+@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
END

CLOSE list_rowguid_indexes
DEALLOCATE list_rowguid_indexes

GO
Declare @.name nvarchar(129)
DECLARE list_rowguid_columns CURSOR FOR
select object_name(syscolumns.id) from syscolumns,
sysobjects where syscolumns.name like 'rowguid'
and sysobjects.id=syscolumns.id
and sysobjects.type='u' order by 1

OPEN list_rowguid_columns

FETCH NEXT FROM list_rowguid_columns INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid columns ' +@.name
select @.name='Alter Table ' + rtrim(@.name ) + '
drop column rowguid'
print @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_columns INTO @.name
END

CLOSE list_rowguid_columns
DEALLOCATE list_rowguid_columns


DELETE FROM sysmergepublications
GO
DELETE FROM sysmergesubscriptions
GO
DELETE FROM syssubscriptions
GO
DELETE FROM sysarticleupdates
GO
DELETE FROM systranschemas
GO
DELETE FROM sysmergearticles
GO
DELETE FROM sysmergeschemaarticles
GO
DELETE FROM sysmergesubscriptions
GO
DELETE FROM sysarticles
GO
DELETE FROM sysschemaarticles
GO
DELETE FROM syspublications
GO
DELETE FROM sysmergeschemachange
GO
DELETE FROM sysmergesubsetfilters
GO
DELETE FROM MSdynamicsnapshotjobs
GO
DELETE FROM MSdynamicsnapshotviews
GO
DELETE FROM MSmerge_altsyncpartners
GO
DELETE FROM MSmerge_contents
GO
DELETE FROM MSmerge_delete_conflicts
GO
DELETE FROM MSmerge_errorlineage
GO
DELETE FROM MSmerge_genhistory
GO
DELETE FROM MSmerge_replinfo
GO
DELETE FROM MSmerge_tombstone
GO
DELETE FROM MSpub_identity_range
GO
DELETE FROM MSrepl_identity_range
GO
DELETE FROM MSreplication_subscriptions
GO
DELETE FROM MSsubscription_agents
GO


****************************************************************************************

DECLARE @.name varchar(129)
DECLARE list_pubs CURSOR FOR
SELECT name FROM sysmergepublications

OPEN list_pubs

FETCH NEXT FROM list_pubs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
/*
sp_dropmergesubscription [ [ @.publication = ] 'publication' ]
[ , [ @.subscriber = ] 'subscriber'
[ , [ @.subscriber_db = ] 'subscriber_db' ]
[ , [ @.subscription_type = ] 'subscription_type' ]
[ , [ @.ignore_distributor = ] ignore_distributor ]
[ , [ @.reserved = ] reserved
*/
PRINT 'dropping publication ' +@.name
EXEC sp_dropmergesubscription @.publication=@.name,
@.subscriber ='all'
EXEC sp_dropmergepublication @.name
FETCH NEXT FROM list_pubs INTO @.name
END

CLOSE list_pubs
DEALLOCATE list_pubs
GO

DECLARE @.name varchar(129)
DECLARE list_replicated_tables CURSOR FOR
SELECT name FROM sysobjects WHERE replinfo <>0
UNION
SELECT name FROM sysmergearticles

OPEN list_replicated_tables

FETCH NEXT FROM list_replicated_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'unmarking replicated table ' +@.name
--select @.name='drop Table ' + @.name
EXEC sp_msunmarkreplinfo @.name
FETCH NEXT FROM list_replicated_tables INTO @.name
END

CLOSE list_replicated_tables
DEALLOCATE list_replicated_tables

GO

UPDATE syscolumns set colstat = colstat & ~4096 WHERE
colstat &4096 <>0
GO
UPDATE sysobjects set replinfo=0
GO

DECLARE @.name nvarchar(129)
DECLARE list_views CURSOR FOR
SELECT name FROM sysobjects WHERE type='V' and (name
like 'syncobj_%' or name like 'ctsv_%' or name
like 'tsvw_%')

OPEN list_views

FETCH NEXT FROM list_views INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping View ' +@.name
select @.name='drop View ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_views INTO @.name
END

CLOSE list_views
DEALLOCATE list_views

GO

DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='p' and (name
like 'sp_ins_%' or name like 'sp_MSdel_%' or name
like 'sp_MSins_%'or name like 'sp_MSupd_%' or name
like 'sp_sel_%' or name like 'sp_upd_%')


OPEN list_procs


FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping procs ' +@.name
select @.name='drop procedure ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs

GO

DECLARE @.name nvarchar(129)
DECLARE list_conflict_tables CURSOR FOR
SELECT name From sysobjects WHERE type='u' and name
like '_onflict%'

OPEN list_conflict_tables

FETCH NEXT FROM list_conflict_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping conflict_tables ' +@.name
select @.name='drop Table ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_conflict_tables INTO @.name
END

CLOSE list_conflict_tables
DEALLOCATE list_conflict_tables

GO

UPDATE syscolumns set colstat=2 WHERE name='rowguid'

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_constraints CURSOR FOR
select object_name(sysobjects.parent_obj), sysobjects.name
from sysobjects, syscolumns where sysobjects.type ='d'
and syscolumns.id=sysobjects.parent_obj
and syscolumns.name='rowguid'

OPEN list_rowguid_constraints

FETCH NEXT FROM list_rowguid_constraints INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid constraints ' +@.name
select @.name='ALTER TABLE ' + rtrim(@.name ) + '
DROP CONSTRAINT ' +@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_constraints INTO
@.name, @.constraint
END

CLOSE list_rowguid_constraints
DEALLOCATE list_rowguid_constraints

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_indexes CURSOR FOR
select object_name(id), name from sysindexes where name
like 'index%'

OPEN list_rowguid_indexes

FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid indexes ' +@.name
select @.name='drop index ' + rtrim(@.name ) + '.'
+@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
END

CLOSE list_rowguid_indexes
DEALLOCATE list_rowguid_indexes

GO
Declare @.name nvarchar(129)
DECLARE list_rowguid_columns CURSOR FOR
select object_name(syscolumns.id) from syscolumns,
sysobjects where syscolumns.name like 'rowguid' and
object_Name(sysobjects.id) not like 'msmerge%'
and sysobjects.id=syscolumns.id
and sysobjects.type='u' order by 1

OPEN list_rowguid_columns

FETCH NEXT FROM list_rowguid_columns INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid columns ' +@.name
select @.name='Alter Table ' + rtrim(@.name ) + '
drop column rowguid'
print @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_columns INTO @.name
END

CLOSE list_rowguid_columns
DEALLOCATE list_rowguid_columns

DELETE FROM sysmergepublications
GO
DELETE FROM sysmergesubscriptions
GO

DELETE FROM sysmergearticles
GO
DELETE FROM sysmergeschemaarticles
GO
DELETE FROM sysmergeschemachange
GO

DELETE ...

*************************************************************************

These are the two scripts

I'm willing to repeat this with new directions to clean up the database if someone has an understantable way to do this.

My version:

/*
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38 Copyright (c) 1988-2003
Microsoft Corporation Personal Edition on Windows NT 5.1
(Build 2600: Service Pack 2)
SP4

*/

This 2 scripts were run on my database.

Thanks allot

|||

The table does not have the rowguid column.

Your front end is still thinking that the column exists and is either trying to insert/update/delete or access it. Check your front end code.

For eg: originally table was: Employee (Name varchar(20), id int, rowguid uniqueidentifier rowguidcol).

and your front end was doing: insert into Employee (Name, id, rowguid) values ('Bill', 1, newid())

or doing: select * from Employee

After you removed replication: table is Employee (Name varchar(20), id int)

Now with this schema, if you try to insert or access the missing column, you will get the above error.

|||

The issue has nothing to do with the front end. I replicated the issue as follows:

Take a database replicated with a merge publication and a push subscription, and (with DTS) copy the database to a SQL Server that does not have Replication configured.

Run the script listed in a previous reply to this posting.

Run any valid SQL that alters the data and makes no reference to the rowguid column.

This produces the error in question.

The solution lies in the Triggers. It appears that Replication either adds or modifies triggers that the scripts fail to remove or fix.

I came up with this code to add to the script, but the catch is that if you've got your own triggers that start "ins_", "del_" and "upd_", this will delete them as well. So you may want to change the name of some of your triggers, first, if you use this naming convention:


DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='tr' and (name
like 'ins_%' or name
like 'del_%' or name
like 'upd_%')

OPEN list_procs

FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping Triggers ' +@.name
select @.name='drop trigger ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs
go

|||So essentially the scripts did not cleanup replication from the database. I believe this is SQL 2000. There is a system stored procedure sp_removedbreplication that will help remove traces of replication from a database. However it is also know that in SQL 2000, this sp may not be completely removing the trace in some cases. It has been improved significantly in SQL 2005. Not that this posting will help resolve the issue, but posting it just for information.|||

Thanks to all.

I managed to go over that problem (it had nothing to do with the front end!) I found some scripts at http://www.replicationanswers.com that were very helpfull.

invalid column name 'rowguid'

Hi all,

I'm new to replication and database management so I will like some understanding and guiding as this is a new task for me.

I was given a copy of a database with merge replication on it and doing allot of reading and using some scripts I cleaned replication (or so Im thinking) and tryed to use it again on the ms-access front end. When I try to update some data I get "invalid column name 'rowguid'" , but no such column exist in my database as it was dropped.

Any help on this?

thanks George.

You refer to rowguid column either with its real column name or ROWGUIDCOL identifier. ie:

create table myTable ( pkid uniqueidentifier rowguid, othercolumn int )

select pkid, othercolumn from myTable

select ROWGUIDCOL, othercolumn from mytable

|||

When you setup merge replication, it adds a guid column to your table article. You scripts may have dropped the column when you clean up the replication and your front end may still have dependency to that column. Perhap, add a dummy column with same name and type to see if that would get your access front end to work.

Regards,

Gary

|||

As Gary mentioned most likely the column is removed when you cleaned up replication.

It is better to update your front end to not reference this non-existant column.

|||

Thanks for the replies.

The database I was given had a pull subscription on it. With the scripts it was cleared. In my access code using breakpoints I did not find any references to this columns in places where the code steps into.

The code I found and used to clean all replication (indexes, rowguid column etc.) in the database follows:

************************************

UPDATE sysobjects set replinfo=0
GO

DECLARE @.name nvarchar(129)
DECLARE list_views CURSOR FOR
SELECT name FROM sysobjects WHERE type='V' and (name
like 'syncobj_%' or name like 'ctsv_%' or name
like 'tsvw_%')

OPEN list_views

FETCH NEXT FROM list_views INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping View ' +@.name
select @.name='drop View ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_views INTO @.name
END

CLOSE list_views
DEALLOCATE list_views

GO

DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='p' and (name
like 'sp_ins_%' or name like 'sp_MSdel_%' or name
like 'sp_MSins_%'or name like 'sp_MSupd_%' or name
like 'sp_sel_%' or name like 'sp_upd_%')

OPEN list_procs

FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping procs ' +@.name
select @.name='drop procedure ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs

GO

DECLARE @.name nvarchar(129)
DECLARE list_conflict_tables CURSOR FOR
SELECT name From sysobjects WHERE type='u' and name
like '_onflict%'

OPEN list_conflict_tables

FETCH NEXT FROM list_conflict_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping conflict_tables ' +@.name
select @.name='drop Table ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_conflict_tables INTO @.name
END

CLOSE list_conflict_tables
DEALLOCATE list_conflict_tables

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_constraints CURSOR FOR
select object_name(sysobjects.parent_obj), sysobjects.name
from sysobjects, syscolumns where sysobjects.type ='d'
and syscolumns.id=sysobjects.parent_obj
and syscolumns.name='rowguid'

OPEN list_rowguid_constraints

FETCH NEXT FROM list_rowguid_constraints INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid constraints ' +@.name
select @.name='ALTER TABLE ' + rtrim(@.name ) + '
DROP CONSTRAINT ' +@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_constraints INTO
@.name, @.constraint
END

CLOSE list_rowguid_constraints
DEALLOCATE list_rowguid_constraints

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_indexes CURSOR FOR
select object_name(id), name from sysindexes where name
like 'index%'

OPEN list_rowguid_indexes

FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid indexes ' +@.name
select @.name='drop index ' + rtrim(@.name ) + '.'
+@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
END

CLOSE list_rowguid_indexes
DEALLOCATE list_rowguid_indexes

GO
Declare @.name nvarchar(129)
DECLARE list_rowguid_columns CURSOR FOR
select object_name(syscolumns.id) from syscolumns,
sysobjects where syscolumns.name like 'rowguid'
and sysobjects.id=syscolumns.id
and sysobjects.type='u' order by 1

OPEN list_rowguid_columns

FETCH NEXT FROM list_rowguid_columns INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid columns ' +@.name
select @.name='Alter Table ' + rtrim(@.name ) + '
drop column rowguid'
print @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_columns INTO @.name
END

CLOSE list_rowguid_columns
DEALLOCATE list_rowguid_columns


DELETE FROM sysmergepublications
GO
DELETE FROM sysmergesubscriptions
GO
DELETE FROM syssubscriptions
GO
DELETE FROM sysarticleupdates
GO
DELETE FROM systranschemas
GO
DELETE FROM sysmergearticles
GO
DELETE FROM sysmergeschemaarticles
GO
DELETE FROM sysmergesubscriptions
GO
DELETE FROM sysarticles
GO
DELETE FROM sysschemaarticles
GO
DELETE FROM syspublications
GO
DELETE FROM sysmergeschemachange
GO
DELETE FROM sysmergesubsetfilters
GO
DELETE FROM MSdynamicsnapshotjobs
GO
DELETE FROM MSdynamicsnapshotviews
GO
DELETE FROM MSmerge_altsyncpartners
GO
DELETE FROM MSmerge_contents
GO
DELETE FROM MSmerge_delete_conflicts
GO
DELETE FROM MSmerge_errorlineage
GO
DELETE FROM MSmerge_genhistory
GO
DELETE FROM MSmerge_replinfo
GO
DELETE FROM MSmerge_tombstone
GO
DELETE FROM MSpub_identity_range
GO
DELETE FROM MSrepl_identity_range
GO
DELETE FROM MSreplication_subscriptions
GO
DELETE FROM MSsubscription_agents
GO


****************************************************************************************

DECLARE @.name varchar(129)
DECLARE list_pubs CURSOR FOR
SELECT name FROM sysmergepublications

OPEN list_pubs

FETCH NEXT FROM list_pubs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
/*
sp_dropmergesubscription [ [ @.publication = ] 'publication' ]
[ , [ @.subscriber = ] 'subscriber'
[ , [ @.subscriber_db = ] 'subscriber_db' ]
[ , [ @.subscription_type = ] 'subscription_type' ]
[ , [ @.ignore_distributor = ] ignore_distributor ]
[ , [ @.reserved = ] reserved
*/
PRINT 'dropping publication ' +@.name
EXEC sp_dropmergesubscription @.publication=@.name,
@.subscriber ='all'
EXEC sp_dropmergepublication @.name
FETCH NEXT FROM list_pubs INTO @.name
END

CLOSE list_pubs
DEALLOCATE list_pubs
GO

DECLARE @.name varchar(129)
DECLARE list_replicated_tables CURSOR FOR
SELECT name FROM sysobjects WHERE replinfo <>0
UNION
SELECT name FROM sysmergearticles

OPEN list_replicated_tables

FETCH NEXT FROM list_replicated_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'unmarking replicated table ' +@.name
--select @.name='drop Table ' + @.name
EXEC sp_msunmarkreplinfo @.name
FETCH NEXT FROM list_replicated_tables INTO @.name
END

CLOSE list_replicated_tables
DEALLOCATE list_replicated_tables

GO

UPDATE syscolumns set colstat = colstat & ~4096 WHERE
colstat &4096 <>0
GO
UPDATE sysobjects set replinfo=0
GO

DECLARE @.name nvarchar(129)
DECLARE list_views CURSOR FOR
SELECT name FROM sysobjects WHERE type='V' and (name
like 'syncobj_%' or name like 'ctsv_%' or name
like 'tsvw_%')

OPEN list_views

FETCH NEXT FROM list_views INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping View ' +@.name
select @.name='drop View ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_views INTO @.name
END

CLOSE list_views
DEALLOCATE list_views

GO

DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='p' and (name
like 'sp_ins_%' or name like 'sp_MSdel_%' or name
like 'sp_MSins_%'or name like 'sp_MSupd_%' or name
like 'sp_sel_%' or name like 'sp_upd_%')


OPEN list_procs


FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping procs ' +@.name
select @.name='drop procedure ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs

GO

DECLARE @.name nvarchar(129)
DECLARE list_conflict_tables CURSOR FOR
SELECT name From sysobjects WHERE type='u' and name
like '_onflict%'

OPEN list_conflict_tables

FETCH NEXT FROM list_conflict_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping conflict_tables ' +@.name
select @.name='drop Table ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_conflict_tables INTO @.name
END

CLOSE list_conflict_tables
DEALLOCATE list_conflict_tables

GO

UPDATE syscolumns set colstat=2 WHERE name='rowguid'

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_constraints CURSOR FOR
select object_name(sysobjects.parent_obj), sysobjects.name
from sysobjects, syscolumns where sysobjects.type ='d'
and syscolumns.id=sysobjects.parent_obj
and syscolumns.name='rowguid'

OPEN list_rowguid_constraints

FETCH NEXT FROM list_rowguid_constraints INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid constraints ' +@.name
select @.name='ALTER TABLE ' + rtrim(@.name ) + '
DROP CONSTRAINT ' +@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_constraints INTO
@.name, @.constraint
END

CLOSE list_rowguid_constraints
DEALLOCATE list_rowguid_constraints

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_indexes CURSOR FOR
select object_name(id), name from sysindexes where name
like 'index%'

OPEN list_rowguid_indexes

FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid indexes ' +@.name
select @.name='drop index ' + rtrim(@.name ) + '.'
+@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
END

CLOSE list_rowguid_indexes
DEALLOCATE list_rowguid_indexes

GO
Declare @.name nvarchar(129)
DECLARE list_rowguid_columns CURSOR FOR
select object_name(syscolumns.id) from syscolumns,
sysobjects where syscolumns.name like 'rowguid' and
object_Name(sysobjects.id) not like 'msmerge%'
and sysobjects.id=syscolumns.id
and sysobjects.type='u' order by 1

OPEN list_rowguid_columns

FETCH NEXT FROM list_rowguid_columns INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid columns ' +@.name
select @.name='Alter Table ' + rtrim(@.name ) + '
drop column rowguid'
print @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_columns INTO @.name
END

CLOSE list_rowguid_columns
DEALLOCATE list_rowguid_columns

DELETE FROM sysmergepublications
GO
DELETE FROM sysmergesubscriptions
GO

DELETE FROM sysmergearticles
GO
DELETE FROM sysmergeschemaarticles
GO
DELETE FROM sysmergeschemachange
GO

DELETE ...

*************************************************************************

These are the two scripts

I'm willing to repeat this with new directions to clean up the database if someone has an understantable way to do this.

My version:

/*
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38 Copyright (c) 1988-2003
Microsoft Corporation Personal Edition on Windows NT 5.1
(Build 2600: Service Pack 2)
SP4

*/

This 2 scripts were run on my database.

Thanks allot

|||

The table does not have the rowguid column.

Your front end is still thinking that the column exists and is either trying to insert/update/delete or access it. Check your front end code.

For eg: originally table was: Employee (Name varchar(20), id int, rowguid uniqueidentifier rowguidcol).

and your front end was doing: insert into Employee (Name, id, rowguid) values ('Bill', 1, newid())

or doing: select * from Employee

After you removed replication: table is Employee (Name varchar(20), id int)

Now with this schema, if you try to insert or access the missing column, you will get the above error.

|||

The issue has nothing to do with the front end. I replicated the issue as follows:

Take a database replicated with a merge publication and a push subscription, and (with DTS) copy the database to a SQL Server that does not have Replication configured.

Run the script listed in a previous reply to this posting.

Run any valid SQL that alters the data and makes no reference to the rowguid column.

This produces the error in question.

The solution lies in the Triggers. It appears that Replication either adds or modifies triggers that the scripts fail to remove or fix.

I came up with this code to add to the script, but the catch is that if you've got your own triggers that start "ins_", "del_" and "upd_", this will delete them as well. So you may want to change the name of some of your triggers, first, if you use this naming convention:


DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='tr' and (name
like 'ins_%' or name
like 'del_%' or name
like 'upd_%')

OPEN list_procs

FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping Triggers ' +@.name
select @.name='drop trigger ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs
go

|||So essentially the scripts did not cleanup replication from the database. I believe this is SQL 2000. There is a system stored procedure sp_removedbreplication that will help remove traces of replication from a database. However it is also know that in SQL 2000, this sp may not be completely removing the trace in some cases. It has been improved significantly in SQL 2005. Not that this posting will help resolve the issue, but posting it just for information.|||

Thanks to all.

I managed to go over that problem (it had nothing to do with the front end!) I found some scripts at http://www.replicationanswers.com that were very helpfull.

Invalid column name 'rowguid'

I'm trying to set up a merge publication in MSSQL 2005 SP1.

I have a database which I have successfully made into a merge publication. When I run the snapshot agent, several articles are processed successfully, then I encounter an error with the following: Invalid column name 'rowguid'

Note that none of the tables contain 'rowguid' columns before this process - I let MSSQL automatically create these as needed.

The replication monitor details the following error:

Error messages:

· Message: Invalid column name 'rowguid'.
Command Text: sp_MSpublicationview
Parameters: @.publication = RelMS Publication
Stack: at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)
at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)
at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate)
at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.MakePublicationViews()
at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoRegularMergeSnapshotPreparations()
at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoPreArticleFilesGenerationProcessing()
at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: MSSQLServer, Error number: 4615)
Get help: http://help/4615

· Server [XXXX\XXXXXX], Level 16, State 1, Procedure , Line 1
Invalid column name 'rowguid'. (Source: MSSQLServer, Error number: 4615)
Get help: http://help/4615

Can anyone shed further light on this?

Thanks.

Further note: I downloaded and applied MSSQL 2005 SP2 just now and started process from scratch (i.e. restored clean database with no replication, then created publication successfully, then ran snapshot agent). Exactly same error was encountered.

Further details that might be relevant:

Publisher and Distributor are set to same. Error persists when compatibility is 2005 or 2000.

Unfortunately the error report doesn't indicate which article was being processed when the error occurred, and the list of successfully processed articles in the log doesn't seem to follow any discernible order.

Any suggestions?

|||

Hi Ramaj;

What are the values for @.keep_partition_changes and @.use_partition_groups parameters in your replication creation script.

|||

Hi Hakan,

@.keep_partition_changes = N'true'

@.use_partition_groups not specified

Thanks

|||

Hi Ramaj;

Could you please try to set @.keep_partition_changes = N'false' then retry to run snapshot.

If the same error occours please try again by adding @.use_partition_groups= N'true' and @.keep_partition_changes = N'false' .

|||

Thanks Hakan, the first step by itself (i.e. @.keep_partition_changes = N'false') did the trick and the snapshot completed successfully. What a strange and misleading error message though - completely had me barking up the wrong tree.

Your help was much appreciated!

|||

I would still be ineterested in finding out what is causing the problem.

Can you run snapshot with higher outputverboseLevel 2. That should tell you which article you have issues with. Then isolating that article in a sepearate publication would help. Also the article schema, publication and article script would really help us troubleshoot the problem.

|||

It's very easy to repro this issue.

Create a one table db with two cols one for filtering.

Below script creates db, table and replication. But the key is to setting keep_partiton_changes = true.

-- CREATE DB
USE [master]
GO
/****** Object: Database [REPLTEST] Script Date: 02/26/2007 10:15:31 ******/
CREATE DATABASE [REPLTEST] ON PRIMARY
( NAME = N'REPLTEST', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\REPLTEST.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'REPLTEST_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\REPLTEST_log.ldf' , SIZE = 3840KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
COLLATE Turkish_CI_AS
GO
EXEC dbo.sp_dbcmptlevel @.dbname=N'REPLTEST', @.new_cmptlevel=90
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [REPLTEST].[dbo].[sp_fulltext_database] @.action = 'disable'
end
GO
ALTER DATABASE [REPLTEST] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [REPLTEST] SET ANSI_NULLS OFF
GO
ALTER DATABASE [REPLTEST] SET ANSI_PADDING OFF
GO
ALTER DATABASE [REPLTEST] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [REPLTEST] SET ARITHABORT OFF
GO
ALTER DATABASE [REPLTEST] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [REPLTEST] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [REPLTEST] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [REPLTEST] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [REPLTEST] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [REPLTEST] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [REPLTEST] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [REPLTEST] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [REPLTEST] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [REPLTEST] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [REPLTEST] SET ENABLE_BROKER
GO
ALTER DATABASE [REPLTEST] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [REPLTEST] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [REPLTEST] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [REPLTEST] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [REPLTEST] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [REPLTEST] SET READ_WRITE
GO
ALTER DATABASE [REPLTEST] SET RECOVERY SIMPLE
GO
ALTER DATABASE [REPLTEST] SET MULTI_USER
GO
ALTER DATABASE [REPLTEST] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [REPLTEST] SET DB_CHAINING OFF
GO

-CREATE TABLE
USE REPLTEST
CREATE TABLE [dbo].[TBLTEST](
Angel [nvarchar](50) COLLATE Turkish_CI_AS NULL,
[UID] [nvarchar](10) COLLATE Turkish_CI_AS NULL,
) ON [PRIMARY]


CREATE REPL
-- Enabling the replication database
use master
exec sp_replicationdboption @.dbname = N'REPLTEST', @.optname = N'merge publish', @.value = N'true'
GO

-- Adding the merge publication
use [REPLTEST]
exec sp_addmergepublication @.publication = N'REPLTEST', @.description = N'Merge publication of REPLTEST database from Publisher CCIMOBILE.', @.sync_mode = N'character', @.retention = 14, @.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous = N'true', @.enabled_for_internet = N'false', @.snapshot_in_defaultfolder = N'true', @.compress_snapshot = N'false', @.ftp_port = 21, @.ftp_login = N'anonymous', @.allow_subscription_copy = N'false', @.add_to_active_directory = N'false', @.dynamic_filters = N'true', @.conflict_retention = 14, @.keep_partition_changes = N'true', @.allow_synctoalternate = N'false', @.validate_subscriber_info = N'HOST_NAME()', @.max_concurrent_merge = 10, @.max_concurrent_dynamic_snapshots = 0, @.use_partition_groups = N'false', @.publication_compatibility_level = N'90RTM', @.replicate_ddl = 1, @.allow_subscriber_initiated_snapshot = N'true', @.allow_web_synchronization = N'false', @.allow_partition_realignment = N'true', @.retention_period_unit = N'days', @.conflict_logging = N'publisher', @.automatic_reinitialization_policy = 0
GO


exec sp_addpublication_snapshot @.publication = N'REPLTEST', @.frequency_type = 1, @.frequency_interval = 0, @.frequency_relative_interval = 0, @.frequency_recurrence_factor = 0, @.frequency_subday = 0, @.frequency_subday_interval = 0, @.active_start_time_of_day = 0, @.active_end_time_of_day = 235959, @.active_start_date = 0, @.active_end_date = 0, @.job_login = null, @.job_password = null, @.publisher_security_mode = 1
exec sp_grant_publication_access @.publication = N'REPLTEST', @.login = N'sa'
GO
exec sp_grant_publication_access @.publication = N'REPLTEST', @.login = N'NT AUTHORITY\SYSTEM'
GO
exec sp_grant_publication_access @.publication = N'REPLTEST', @.login = N'BUILTIN\Administrators'
GO
exec sp_grant_publication_access @.publication = N'REPLTEST', @.login = N'HQMRKT\SQLServer2005SQLAgentUser$HQMRKT$SQL2005'
GO
exec sp_grant_publication_access @.publication = N'REPLTEST', @.login = N'HQMRKT\SQLServer2005MSSQLUser$HQMRKT$SQL2005'
GO
exec sp_grant_publication_access @.publication = N'REPLTEST', @.login = N'distributor_admin'
GO

-- Adding the merge articles
use [REPLTEST]
exec sp_addmergearticle @.publication = N'REPLTEST', @.article = N'TBLTEST', @.source_owner = N'dbo', @.source_object = N'TBLTEST', @.type = N'table', @.description = N'', @.creation_script = N'', @.pre_creation_cmd = N'drop', @.schema_option = 0x000000003000CFF1, @.identityrangemanagementoption = N'none', @.destination_owner = N'dbo', @.force_reinit_subscription = 1, @.column_tracking = N'true', @.subset_filterclause = N'UID=HOST_NAME()', @.vertical_partition = N'false', @.verify_resolver_signature = 0, @.allow_interactive_resolver = N'false', @.fast_multicol_updateproc = N'true', @.check_permissions = 0, @.subscriber_upload_options = 2, @.delete_tracking = N'true', @.compensate_for_errors = N'false', @.stream_blob_columns = N'false', @.partition_options = 0
GO

use [REPLTEST]
exec sp_changemergepublication N'REPLTEST', N'status', N'active'
GO

|||

Here is the verbose log of the snapshot agent:

2007-02-26 08:38:58.98
2007-02-26 08:38:58.98 Microsoft (R) SQL Server Snapshot Agent
2007-02-26 08:38:58.98 [Assembly Version = 9.0.242.0, File Version = 9.00.2047.00]
2007-02-26 08:38:58.98 Copyright (C) 1988-2005 Microsoft Corporation. All rights reserved.
2007-02-26 08:38:58.98 The timestamps prepended to the output lines are expressed in terms of UTC time.
2007-02-26 08:38:58.98 User-specified agent parameter values:
2007-02-26 08:38:58.98 --
2007-02-26 08:38:58.98 -Publisher HQMRKT\SQL2005
2007-02-26 08:38:58.98 -PublisherDB REPLTEST
2007-02-26 08:38:58.98 -Publication REPLTEST
2007-02-26 08:38:58.98 -ReplicationType 2
2007-02-26 08:38:58.98 -Distributor HQMRKT\SQL2005
2007-02-26 08:38:58.98 -DistributorSecurityMode 1
2007-02-26 08:38:58.98 -Output C:\ReplOutput.txt
2007-02-26 08:38:58.98 -OutputVerboseLevel 2
2007-02-26 08:38:58.98 -XJOBID 0xEC583CE49E702944B367AF1E70053178
2007-02-26 08:38:58.98 --
2007-02-26 08:38:58.98 Connecting to Distributor 'HQMRKT\SQL2005'
2007-02-26 08:38:59.20
2007-02-26 08:38:59.20 SQL Command dump
2007-02-26 08:38:59.20 ================
2007-02-26 08:38:59.20 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.20 Database: master
2007-02-26 08:38:59.20 Command Text: sp_helpdistpublisher
2007-02-26 08:38:59.20 Parameters:
2007-02-26 08:38:59.20 @.publisher = HQMRKT\SQL2005
2007-02-26 08:38:59.20
2007-02-26 08:38:59.20 SQL Command dump
2007-02-26 08:38:59.20 ================
2007-02-26 08:38:59.20 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.20 Database: distribution
2007-02-26 08:38:59.20 Command Text: select 'id' = convert(int, srvid) from master..sysservers where upper(srvname) = upper(N'HQMRKT\SQL2005')
2007-02-26 08:38:59.20 Parameters:
2007-02-26 08:38:59.21
2007-02-26 08:38:59.21 SQL Command dump
2007-02-26 08:38:59.21 ================
2007-02-26 08:38:59.21 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.21 Database: distribution
2007-02-26 08:38:59.21 Command Text: sp_MShelp_snapshot_agentid
2007-02-26 08:38:59.21 Parameters:
2007-02-26 08:38:59.21 @.publisher_id = 0
2007-02-26 08:38:59.21 @.publisher_db = REPLTEST
2007-02-26 08:38:59.21 @.publication = REPLTEST
2007-02-26 08:38:59.21 @.job_id = System.Byte[]
2007-02-26 08:38:59.21
2007-02-26 08:38:59.21 SQL Command dump
2007-02-26 08:38:59.21 ================
2007-02-26 08:38:59.21 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.21 Database: distribution
2007-02-26 08:38:59.21 Command Text: sp_MShelp_snapshot_agent
2007-02-26 08:38:59.21 Parameters:
2007-02-26 08:38:59.21 @.agent_id = 1244
2007-02-26 08:38:59.23
2007-02-26 08:38:59.23 SQL Command dump
2007-02-26 08:38:59.23 ================
2007-02-26 08:38:59.23 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.23 Database: distribution
2007-02-26 08:38:59.23 Command Text: sp_MShelp_profile
2007-02-26 08:38:59.23 Parameters:
2007-02-26 08:38:59.23 @.agent_id = 1244
2007-02-26 08:38:59.23 @.agent_type = 1
2007-02-26 08:38:59.23 @.profile_name =
2007-02-26 08:38:59.23 Parameter values obtained from agent profile:
2007-02-26 08:38:59.23
2007-02-26 08:38:59.23 -BcpBatchSize 100000
2007-02-26 08:38:59.23 -HistoryVerboseLevel 2
2007-02-26 08:38:59.23 -LoginTimeout 15
2007-02-26 08:38:59.23 -QueryTimeout 1800
2007-02-26 08:38:59.23
2007-02-26 08:38:59.26 Connecting to Publisher 'HQMRKT\SQL2005'
2007-02-26 08:38:59.29
2007-02-26 08:38:59.29 SQL Command dump
2007-02-26 08:38:59.29 ================
2007-02-26 08:38:59.29 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.29 Database: REPLTEST
2007-02-26 08:38:59.29 Command Text: use master
2007-02-26 08:38:59.29 select isnull(convert(int, value_in_use), 0) from master.sys.configurations where lower(name) = 'smo and dmo xps'
2007-02-26 08:38:59.29 use [REPLTEST]
2007-02-26 08:38:59.29 Parameters:
2007-02-26 08:38:59.29
2007-02-26 08:38:59.29 SQL Command dump
2007-02-26 08:38:59.29 ================
2007-02-26 08:38:59.29 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.29 Database: REPLTEST
2007-02-26 08:38:59.29 Command Text: use [REPLTEST]
2007-02-26 08:38:59.29 select publishingservername(), convert(int, compatibility_level) from sys.databases where name = @.database_name
2007-02-26 08:38:59.29 Parameters:
2007-02-26 08:38:59.29 @.database_name = REPLTEST
2007-02-26 08:38:59.31 Publisher database compatibility level is set to 90.
2007-02-26 08:38:59.31
2007-02-26 08:38:59.31 SQL Command dump
2007-02-26 08:38:59.31 ================
2007-02-26 08:38:59.31 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.31 Database: REPLTEST
2007-02-26 08:38:59.31 Command Text: select convert(int, isnull(is_member('db_owner'),0))
2007-02-26 08:38:59.31 Parameters:
2007-02-26 08:38:59.31
2007-02-26 08:38:59.31 SQL Command dump
2007-02-26 08:38:59.31 ================
2007-02-26 08:38:59.31 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.31 Database: REPLTEST
2007-02-26 08:38:59.31 Command Text:
2007-02-26 08:38:59.31 declare @.retcode int
2007-02-26 08:38:59.31 exec @.retcode = sys.sp_getapplock @.Resource = N'HQMRKT\SQL2005-REPLTEST-REPLTEST-1244',
2007-02-26 08:38:59.31 @.LockMode = N'Exclusive',
2007-02-26 08:38:59.31 @.LockOwner = N'Session',
2007-02-26 08:38:59.31 @.LockTimeout = 0,
2007-02-26 08:38:59.31 @.DbPrincipal = N'db_owner'
2007-02-26 08:38:59.31 if @.retcode < 0 raiserror(21036, 16, -1, 'snapshot')
2007-02-26 08:38:59.31 Parameters:
2007-02-26 08:38:59.31 Retrieving publication and article information from the publisher database 'HQMRKT\SQL2005.REPLTEST'
2007-02-26 08:38:59.31
2007-02-26 08:38:59.31 SQL Command dump
2007-02-26 08:38:59.31 ================
2007-02-26 08:38:59.31 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.31 Database: REPLTEST
2007-02-26 08:38:59.31 Command Text: sp_helpmergepublication
2007-02-26 08:38:59.31 Parameters:
2007-02-26 08:38:59.31 @.publication = REPLTEST
2007-02-26 08:38:59.31 @.reserved = fromSnapshot
2007-02-26 08:38:59.32
2007-02-26 08:38:59.32 SQL Command dump
2007-02-26 08:38:59.32 ================
2007-02-26 08:38:59.32 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.32 Database: REPLTEST
2007-02-26 08:38:59.32 Command Text: sys.sp_MSset_dynamic_filter_options
2007-02-26 08:38:59.32 Parameters:
2007-02-26 08:38:59.32 @.publication = REPLTEST
2007-02-26 08:38:59.32 @.dynamic_filters = True
2007-02-26 08:38:59.39
2007-02-26 08:38:59.39 SQL Command dump
2007-02-26 08:38:59.39 ================
2007-02-26 08:38:59.39 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.39 Database: REPLTEST
2007-02-26 08:38:59.39 Command Text: declare @.ftp_password nvarchar(524) select @.ftp_password = ftp_password from dbo.sysmergepublications where name = N'REPLTEST' and publisher_db = N'REPLTEST' and upper(publisher) = upper(N'HQMRKT\SQL2005') if object_id('sys.fn_repldecryptver4', 'FN') is not null begin select sys.fn_repldecryptver4(@.ftp_password) end else begin select @.ftp_password end
2007-02-26 08:38:59.39 Parameters:
2007-02-26 08:38:59.39
2007-02-26 08:38:59.39 SQL Command dump
2007-02-26 08:38:59.39 ================
2007-02-26 08:38:59.39 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.39 Database: REPLTEST
2007-02-26 08:38:59.39 Command Text: sp_MSestimatemergesnapshotworkload
2007-02-26 08:38:59.39 Parameters:
2007-02-26 08:38:59.39 @.publication = REPLTEST
2007-02-26 08:38:59.40
2007-02-26 08:38:59.40 SQL Command dump
2007-02-26 08:38:59.40 ================
2007-02-26 08:38:59.40 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.40 Database: REPLTEST
2007-02-26 08:38:59.40 Command Text: sp_helpmergearticle
2007-02-26 08:38:59.40 Parameters:
2007-02-26 08:38:59.40 @.publication = REPLTEST
2007-02-26 08:38:59.42
2007-02-26 08:38:59.42 SQL Command dump
2007-02-26 08:38:59.42 ================
2007-02-26 08:38:59.42 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.42 Database: REPLTEST
2007-02-26 08:38:59.42 Command Text: sys.sp_MSget_load_hint
2007-02-26 08:38:59.42 Parameters:
2007-02-26 08:38:59.42 @.qualified_source_object_name = [dbo].[TBLTEST]
2007-02-26 08:38:59.42 @.qualified_sync_object_name = [dbo].[MSmerge_REPLTEST_TBLTEST_VIEW]
2007-02-26 08:38:59.42 @.primary_key_only = False
2007-02-26 08:38:59.42 @.is_vertically_partitioned = False
2007-02-26 08:38:59.42
2007-02-26 08:38:59.42 SQL Command dump
2007-02-26 08:38:59.42 ================
2007-02-26 08:38:59.42 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.42 Database: REPLTEST
2007-02-26 08:38:59.42 Command Text: sp_MSvalidate_wellpartitioned_articles
2007-02-26 08:38:59.42 Parameters:
2007-02-26 08:38:59.42 @.publication = REPLTEST
2007-02-26 08:38:59.42
2007-02-26 08:38:59.42 SQL Command dump
2007-02-26 08:38:59.42 ================
2007-02-26 08:38:59.42 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.42 Database: REPLTEST
2007-02-26 08:38:59.42 Command Text: sp_browsemergesnapshotfolder
2007-02-26 08:38:59.42 Parameters:
2007-02-26 08:38:59.42 @.publication = REPLTEST
2007-02-26 08:38:59.43
2007-02-26 08:38:59.43 SQL Command dump
2007-02-26 08:38:59.43 ================
2007-02-26 08:38:59.43 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.43 Database: REPLTEST
2007-02-26 08:38:59.43 Command Text: sys.sp_MSgetmergeadminapplock
2007-02-26 08:38:59.43 Parameters:
2007-02-26 08:38:59.43 @.timeout = -1
2007-02-26 08:38:59.43 @.lockmode = Exclusive
2007-02-26 08:38:59.43 @.lock_acquired = -1
2007-02-26 08:38:59.43
2007-02-26 08:38:59.43 SQL Command dump
2007-02-26 08:38:59.43 ================
2007-02-26 08:38:59.43 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.43 Database: REPLTEST
2007-02-26 08:38:59.43 Command Text: sp_MSenumpubreferences
2007-02-26 08:38:59.43 Parameters:
2007-02-26 08:38:59.43 @.publication = REPLTEST
2007-02-26 08:38:59.43
2007-02-26 08:38:59.43 SQL Command dump
2007-02-26 08:38:59.43 ================
2007-02-26 08:38:59.43 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.43 Database: REPLTEST
2007-02-26 08:38:59.43 Command Text:
2007-02-26 08:38:59.43 declare @.retcode int,
2007-02-26 08:38:59.43 @.resource sysname,
2007-02-26 08:38:59.43 @.DbPrincipal sysname,
2007-02-26 08:38:59.43 @.pubid uniqueidentifier
2007-02-26 08:38:59.43
2007-02-26 08:38:59.43 select @.resource = N'dynpub_' + convert(nvarchar(36), pubid), @.pubid = pubid
2007-02-26 08:38:59.43 from dbo.sysmergepublications
2007-02-26 08:38:59.43 where name = N'REPLTEST'
2007-02-26 08:38:59.43 and upper(publisher) = upper(publishingservername())
2007-02-26 08:38:59.43 and publisher_db = db_name()
2007-02-26 08:38:59.43
2007-02-26 08:38:59.43 execute sys.sp_MSrepl_FixPALRole @.pubid = @.pubid, @.role = @.DbPrincipal output
2007-02-26 08:38:59.43
2007-02-26 08:38:59.43 execute @.retcode = sys.sp_getapplock @.Resource = @.resource,
2007-02-26 08:38:59.43 @.LockOwner = N'Session',
2007-02-26 08:38:59.43 @.LockMode = N'Exclusive',
2007-02-26 08:38:59.43 @.LockTimeout = 0,
2007-02-26 08:38:59.43 @.DbPrincipal = @.DbPrincipal
2007-02-26 08:38:59.43
2007-02-26 08:38:59.43 select 'LockOutcome' = @.retcode, 'LockName' = @.resource, 'DbPrincipal' = @.DbPrincipal
2007-02-26 08:38:59.43
2007-02-26 08:38:59.43 Parameters:
2007-02-26 08:38:59.45 [0%] Preparing table '[dbo].[TBLTEST]' for merge replication
2007-02-26 08:38:59.45
2007-02-26 08:38:59.45 SQL Command dump
2007-02-26 08:38:59.45 ================
2007-02-26 08:38:59.45 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.45 Database: REPLTEST
2007-02-26 08:38:59.45 Command Text: SET TRANSACTION ISOLATION LEVEL READ COMMITTED;BEGIN TRANSACTION
2007-02-26 08:38:59.45 Parameters:
2007-02-26 08:38:59.45
2007-02-26 08:38:59.45 SQL Command dump
2007-02-26 08:38:59.45 ================
2007-02-26 08:38:59.45 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.45 Database: REPLTEST
2007-02-26 08:38:59.45 Command Text: SELECT * FROM [dbo].[TBLTEST] WITH (TABLOCK HOLDLOCK) WHERE 1 = 2
2007-02-26 08:38:59.45 Parameters:
2007-02-26 08:38:59.45
2007-02-26 08:38:59.45 SQL Command dump
2007-02-26 08:38:59.45 ================
2007-02-26 08:38:59.45 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.45 Database: REPLTEST
2007-02-26 08:38:59.45 Command Text: sp_MSprepare_mergearticle
2007-02-26 08:38:59.45 Parameters:
2007-02-26 08:38:59.45 @.source_owner = dbo
2007-02-26 08:38:59.45 @.source_table = TBLTEST
2007-02-26 08:38:59.45 @.publication = REPLTEST
2007-02-26 08:38:59.45 @.qualified_tablename = [dbo].[TBLTEST]
2007-02-26 08:38:59.46
2007-02-26 08:38:59.46 SQL Command dump
2007-02-26 08:38:59.46 ================
2007-02-26 08:38:59.46 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.46 Database: REPLTEST
2007-02-26 08:38:59.46 Command Text: COMMIT TRANSACTION
2007-02-26 08:38:59.46 Parameters:
2007-02-26 08:38:59.53
2007-02-26 08:38:59.53 SQL Command dump
2007-02-26 08:38:59.53 ================
2007-02-26 08:38:59.53 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.53 Database: REPLTEST
2007-02-26 08:38:59.53 Command Text: sp_MSpublicationview
2007-02-26 08:38:59.53 Parameters:
2007-02-26 08:38:59.53 @.publication = REPLTEST
2007-02-26 08:38:59.70
2007-02-26 08:38:59.70 SQL Command dump
2007-02-26 08:38:59.70 ================
2007-02-26 08:38:59.70 Server: HQMRKT\SQL2005
2007-02-26 08:38:59.70 Database: REPLTEST
2007-02-26 08:38:59.70 Command Text: sys.sp_releaseapplock
2007-02-26 08:38:59.70 Parameters:
2007-02-26 08:38:59.70 @.Resource = HQMRKT\SQL2005-REPLTEST-REPLTEST-1244
2007-02-26 08:38:59.70 @.LockOwner = Session
2007-02-26 08:38:59.70 @.DbPrincipal = db_owner
2007-02-26 08:38:59.71 [3%] The replication agent had encountered an exception.
2007-02-26 08:38:59.71 Source: Replication
2007-02-26 08:38:59.71 Exception Type: Microsoft.SqlServer.Replication.ReplicationAgentSqlException
2007-02-26 08:38:59.71 Exception Message: Invalid column name 'rowguid'.
2007-02-26 08:38:59.71 Message Code: 4615
2007-02-26 08:38:59.71
2007-02-26 08:38:59.71 Call Stack:
2007-02-26 08:38:59.71 Microsoft.SqlServer.Replication.ReplicationAgentSqlException: Invalid column name 'rowguid'. > System.Data.SqlClient.SqlException: Invalid column name 'rowguid'.
2007-02-26 08:38:59.71 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
2007-02-26 08:38:59.71 at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
2007-02-26 08:38:59.71 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
2007-02-26 08:38:59.71 at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
2007-02-26 08:38:59.71 at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
2007-02-26 08:38:59.71 at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
2007-02-26 08:38:59.71 at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
2007-02-26 08:38:59.71 at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
2007-02-26 08:38:59.71 at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
2007-02-26 08:38:59.71 End of inner exception stack trace
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate)
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.MakePublicationViews()
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoRegularMergeSnapshotPreparations()
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoPreArticleFilesGenerationProcessing()
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
2007-02-26 08:38:59.71 at Microsoft.SqlServer.Replication.AgentCore.Run()

invalid column name 'rowguid'

Hi all,

I'm new to replication and database management so I will like some understanding and guiding as this is a new task for me.

I was given a copy of a database with merge replication on it and doing allot of reading and using some scripts I cleaned replication (or so Im thinking) and tryed to use it again on the ms-access front end. When I try to update some data I get "invalid column name 'rowguid'" , but no such column exist in my database as it was dropped.

Any help on this?

thanks George.

You refer to rowguid column either with its real column name or ROWGUIDCOL identifier. ie:

create table myTable ( pkid uniqueidentifier rowguid, othercolumn int )

select pkid, othercolumn from myTable

select ROWGUIDCOL, othercolumn from mytable

|||

When you setup merge replication, it adds a guid column to your table article. You scripts may have dropped the column when you clean up the replication and your front end may still have dependency to that column. Perhap, add a dummy column with same name and type to see if that would get your access front end to work.

Regards,

Gary

|||

As Gary mentioned most likely the column is removed when you cleaned up replication.

It is better to update your front end to not reference this non-existant column.

|||

Thanks for the replies.

The database I was given had a pull subscription on it. With the scripts it was cleared. In my access code using breakpoints I did not find any references to this columns in places where the code steps into.

The code I found and used to clean all replication (indexes, rowguid column etc.) in the database follows:

************************************

UPDATE sysobjects set replinfo=0
GO

DECLARE @.name nvarchar(129)
DECLARE list_views CURSOR FOR
SELECT name FROM sysobjects WHERE type='V' and (name
like 'syncobj_%' or name like 'ctsv_%' or name
like 'tsvw_%')

OPEN list_views

FETCH NEXT FROM list_views INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping View ' +@.name
select @.name='drop View ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_views INTO @.name
END

CLOSE list_views
DEALLOCATE list_views

GO

DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='p' and (name
like 'sp_ins_%' or name like 'sp_MSdel_%' or name
like 'sp_MSins_%'or name like 'sp_MSupd_%' or name
like 'sp_sel_%' or name like 'sp_upd_%')

OPEN list_procs

FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping procs ' +@.name
select @.name='drop procedure ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs

GO

DECLARE @.name nvarchar(129)
DECLARE list_conflict_tables CURSOR FOR
SELECT name From sysobjects WHERE type='u' and name
like '_onflict%'

OPEN list_conflict_tables

FETCH NEXT FROM list_conflict_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping conflict_tables ' +@.name
select @.name='drop Table ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_conflict_tables INTO @.name
END

CLOSE list_conflict_tables
DEALLOCATE list_conflict_tables

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_constraints CURSOR FOR
select object_name(sysobjects.parent_obj), sysobjects.name
from sysobjects, syscolumns where sysobjects.type ='d'
and syscolumns.id=sysobjects.parent_obj
and syscolumns.name='rowguid'

OPEN list_rowguid_constraints

FETCH NEXT FROM list_rowguid_constraints INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid constraints ' +@.name
select @.name='ALTER TABLE ' + rtrim(@.name ) + '
DROP CONSTRAINT ' +@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_constraints INTO
@.name, @.constraint
END

CLOSE list_rowguid_constraints
DEALLOCATE list_rowguid_constraints

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_indexes CURSOR FOR
select object_name(id), name from sysindexes where name
like 'index%'

OPEN list_rowguid_indexes

FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid indexes ' +@.name
select @.name='drop index ' + rtrim(@.name ) + '.'
+@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
END

CLOSE list_rowguid_indexes
DEALLOCATE list_rowguid_indexes

GO
Declare @.name nvarchar(129)
DECLARE list_rowguid_columns CURSOR FOR
select object_name(syscolumns.id) from syscolumns,
sysobjects where syscolumns.name like 'rowguid'
and sysobjects.id=syscolumns.id
and sysobjects.type='u' order by 1

OPEN list_rowguid_columns

FETCH NEXT FROM list_rowguid_columns INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid columns ' +@.name
select @.name='Alter Table ' + rtrim(@.name ) + '
drop column rowguid'
print @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_columns INTO @.name
END

CLOSE list_rowguid_columns
DEALLOCATE list_rowguid_columns


DELETE FROM sysmergepublications
GO
DELETE FROM sysmergesubscriptions
GO
DELETE FROM syssubscriptions
GO
DELETE FROM sysarticleupdates
GO
DELETE FROM systranschemas
GO
DELETE FROM sysmergearticles
GO
DELETE FROM sysmergeschemaarticles
GO
DELETE FROM sysmergesubscriptions
GO
DELETE FROM sysarticles
GO
DELETE FROM sysschemaarticles
GO
DELETE FROM syspublications
GO
DELETE FROM sysmergeschemachange
GO
DELETE FROM sysmergesubsetfilters
GO
DELETE FROM MSdynamicsnapshotjobs
GO
DELETE FROM MSdynamicsnapshotviews
GO
DELETE FROM MSmerge_altsyncpartners
GO
DELETE FROM MSmerge_contents
GO
DELETE FROM MSmerge_delete_conflicts
GO
DELETE FROM MSmerge_errorlineage
GO
DELETE FROM MSmerge_genhistory
GO
DELETE FROM MSmerge_replinfo
GO
DELETE FROM MSmerge_tombstone
GO
DELETE FROM MSpub_identity_range
GO
DELETE FROM MSrepl_identity_range
GO
DELETE FROM MSreplication_subscriptions
GO
DELETE FROM MSsubscription_agents
GO


****************************************************************************************

DECLARE @.name varchar(129)
DECLARE list_pubs CURSOR FOR
SELECT name FROM sysmergepublications

OPEN list_pubs

FETCH NEXT FROM list_pubs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
/*
sp_dropmergesubscription [ [ @.publication = ] 'publication' ]
[ , [ @.subscriber = ] 'subscriber'
[ , [ @.subscriber_db = ] 'subscriber_db' ]
[ , [ @.subscription_type = ] 'subscription_type' ]
[ , [ @.ignore_distributor = ] ignore_distributor ]
[ , [ @.reserved = ] reserved
*/
PRINT 'dropping publication ' +@.name
EXEC sp_dropmergesubscription @.publication=@.name,
@.subscriber ='all'
EXEC sp_dropmergepublication @.name
FETCH NEXT FROM list_pubs INTO @.name
END

CLOSE list_pubs
DEALLOCATE list_pubs
GO

DECLARE @.name varchar(129)
DECLARE list_replicated_tables CURSOR FOR
SELECT name FROM sysobjects WHERE replinfo <>0
UNION
SELECT name FROM sysmergearticles

OPEN list_replicated_tables

FETCH NEXT FROM list_replicated_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'unmarking replicated table ' +@.name
--select @.name='drop Table ' + @.name
EXEC sp_msunmarkreplinfo @.name
FETCH NEXT FROM list_replicated_tables INTO @.name
END

CLOSE list_replicated_tables
DEALLOCATE list_replicated_tables

GO

UPDATE syscolumns set colstat = colstat & ~4096 WHERE
colstat &4096 <>0
GO
UPDATE sysobjects set replinfo=0
GO

DECLARE @.name nvarchar(129)
DECLARE list_views CURSOR FOR
SELECT name FROM sysobjects WHERE type='V' and (name
like 'syncobj_%' or name like 'ctsv_%' or name
like 'tsvw_%')

OPEN list_views

FETCH NEXT FROM list_views INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping View ' +@.name
select @.name='drop View ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_views INTO @.name
END

CLOSE list_views
DEALLOCATE list_views

GO

DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='p' and (name
like 'sp_ins_%' or name like 'sp_MSdel_%' or name
like 'sp_MSins_%'or name like 'sp_MSupd_%' or name
like 'sp_sel_%' or name like 'sp_upd_%')


OPEN list_procs


FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping procs ' +@.name
select @.name='drop procedure ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs

GO

DECLARE @.name nvarchar(129)
DECLARE list_conflict_tables CURSOR FOR
SELECT name From sysobjects WHERE type='u' and name
like '_onflict%'

OPEN list_conflict_tables

FETCH NEXT FROM list_conflict_tables INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping conflict_tables ' +@.name
select @.name='drop Table ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_conflict_tables INTO @.name
END

CLOSE list_conflict_tables
DEALLOCATE list_conflict_tables

GO

UPDATE syscolumns set colstat=2 WHERE name='rowguid'

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_constraints CURSOR FOR
select object_name(sysobjects.parent_obj), sysobjects.name
from sysobjects, syscolumns where sysobjects.type ='d'
and syscolumns.id=sysobjects.parent_obj
and syscolumns.name='rowguid'

OPEN list_rowguid_constraints

FETCH NEXT FROM list_rowguid_constraints INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid constraints ' +@.name
select @.name='ALTER TABLE ' + rtrim(@.name ) + '
DROP CONSTRAINT ' +@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_constraints INTO
@.name, @.constraint
END

CLOSE list_rowguid_constraints
DEALLOCATE list_rowguid_constraints

GO

Declare @.name nvarchar(129), @.constraint nvarchar(129)
DECLARE list_rowguid_indexes CURSOR FOR
select object_name(id), name from sysindexes where name
like 'index%'

OPEN list_rowguid_indexes

FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid indexes ' +@.name
select @.name='drop index ' + rtrim(@.name ) + '.'
+@.constraint
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_indexes INTO @.name,
@.constraint
END

CLOSE list_rowguid_indexes
DEALLOCATE list_rowguid_indexes

GO
Declare @.name nvarchar(129)
DECLARE list_rowguid_columns CURSOR FOR
select object_name(syscolumns.id) from syscolumns,
sysobjects where syscolumns.name like 'rowguid' and
object_Name(sysobjects.id) not like 'msmerge%'
and sysobjects.id=syscolumns.id
and sysobjects.type='u' order by 1

OPEN list_rowguid_columns

FETCH NEXT FROM list_rowguid_columns INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping rowguid columns ' +@.name
select @.name='Alter Table ' + rtrim(@.name ) + '
drop column rowguid'
print @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_rowguid_columns INTO @.name
END

CLOSE list_rowguid_columns
DEALLOCATE list_rowguid_columns

DELETE FROM sysmergepublications
GO
DELETE FROM sysmergesubscriptions
GO

DELETE FROM sysmergearticles
GO
DELETE FROM sysmergeschemaarticles
GO
DELETE FROM sysmergeschemachange
GO

DELETE ...

*************************************************************************

These are the two scripts

I'm willing to repeat this with new directions to clean up the database if someone has an understantable way to do this.

My version:

/*
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38 Copyright (c) 1988-2003
Microsoft Corporation Personal Edition on Windows NT 5.1
(Build 2600: Service Pack 2)
SP4

*/

This 2 scripts were run on my database.

Thanks allot

|||

The table does not have the rowguid column.

Your front end is still thinking that the column exists and is either trying to insert/update/delete or access it. Check your front end code.

For eg: originally table was: Employee (Name varchar(20), id int, rowguid uniqueidentifier rowguidcol).

and your front end was doing: insert into Employee (Name, id, rowguid) values ('Bill', 1, newid())

or doing: select * from Employee

After you removed replication: table is Employee (Name varchar(20), id int)

Now with this schema, if you try to insert or access the missing column, you will get the above error.

|||

The issue has nothing to do with the front end. I replicated the issue as follows:

Take a database replicated with a merge publication and a push subscription, and (with DTS) copy the database to a SQL Server that does not have Replication configured.

Run the script listed in a previous reply to this posting.

Run any valid SQL that alters the data and makes no reference to the rowguid column.

This produces the error in question.

The solution lies in the Triggers. It appears that Replication either adds or modifies triggers that the scripts fail to remove or fix.

I came up with this code to add to the script, but the catch is that if you've got your own triggers that start "ins_", "del_" and "upd_", this will delete them as well. So you may want to change the name of some of your triggers, first, if you use this naming convention:


DECLARE @.name nvarchar(129)
DECLARE list_procs CURSOR FOR
SELECT name FROM sysobjects WHERE type='tr' and (name
like 'ins_%' or name
like 'del_%' or name
like 'upd_%')

OPEN list_procs

FETCH NEXT FROM list_procs INTO @.name
WHILE @.@.FETCH_STATUS = 0
BEGIN
PRINT 'dropping Triggers ' +@.name
select @.name='drop trigger ' + @.name
EXEC sp_executesql @.name
FETCH NEXT FROM list_procs INTO @.name
END

CLOSE list_procs
DEALLOCATE list_procs
go

|||So essentially the scripts did not cleanup replication from the database. I believe this is SQL 2000. There is a system stored procedure sp_removedbreplication that will help remove traces of replication from a database. However it is also know that in SQL 2000, this sp may not be completely removing the trace in some cases. It has been improved significantly in SQL 2005. Not that this posting will help resolve the issue, but posting it just for information.|||

Thanks to all.

I managed to go over that problem (it had nothing to do with the front end!) I found some scripts at http://www.replicationanswers.com that were very helpfull.