Hello,
Merge Replication, SQL Server 2005
I have got a table with an update trigger that is supposed to fire when a
user updates a field.
When replicating this database, the trigger fires when a user updates a
field *and* when the update is performed by the replication process.
How can I avoid the latter? Is there a TSQL-function to distinguish the two?
Thanks for your effort, Wolfgang
Another way is to hack into the sessionproperty
ie if ('replication_agent') <> 1 then its a user action.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Wolfgang" <Wolfgang@.discussions.microsoft.com> wrote in message
news:168538E7-89A2-45F3-ABD6-566F2C4B3760@.microsoft.com...
> Hello,
> Merge Replication, SQL Server 2005
> I have got a table with an update trigger that is supposed to fire when a
> user updates a field.
> When replicating this database, the trigger fires when a user updates a
> field *and* when the update is performed by the replication process.
> How can I avoid the latter? Is there a TSQL-function to distinguish the
> two?
> Thanks for your effort, Wolfgang
sql
Showing posts with label merge. Show all posts
Showing posts with label merge. Show all posts
Tuesday, March 27, 2012
Thursday, March 22, 2012
DISTINCT First Name and Last Name for Mail Merge
I'm trying to create a mail merge on my MS SQL database. Many of my owners are entered more than once as they might own multiple properties. I'm trying to write a query where each is only pulled one time and I'm having some trouble. I think I need to use SELECT DISTINCT, but I need to make sure I don't filter out people with the same first name and different last names and vice versa. Thanks!One of my old bosses insisted this could be done using soundex
don't know, but maybe that is an area to start?
http://www.4guysfromrolla.com/webtech/tips/t103101-1.shtml
good luck|||It doesn't need to be that deep.
I thought of another idea. How do I use SELECT DISTINCT to return all rows in my table and only unique address fields?|||I think that a group statement might accomplish this??
as in
select f_name from table group by f_name
I re-read your post...
address validation is a trick...
the address field can be set up many ways, and the street
type designation can also be setup in a whole slew
of different ways...
what does your address field look like (sample data)
thanks
tony|||Soundex is a practically useless algorithm.
You can select distinct First/Last names in a subquery, but then which address would you use if the two records do not agree?
Here is one of the simplest methods:select YourTable.*
from YourTable
inner join --DistinctNames
(select Max(PrimaryKey) as PrimaryKey
from YourTable
group by FirstName,
LastName) DistinctNames
on YourTable.PrimaryKey = DistinctNames.PrimaryKey|||You da' Blindman! Thanks, that's exactly what I needed.|||I hate to post an extension to the question in the same place, but here goes. My owners are listed more than once if they own more than once parcel of land. What I need to do next is continue the merge to each only once, but add up their land acreage amounts and total for each person. Thoughts anyone? Thanks in advance.sql
don't know, but maybe that is an area to start?
http://www.4guysfromrolla.com/webtech/tips/t103101-1.shtml
good luck|||It doesn't need to be that deep.
I thought of another idea. How do I use SELECT DISTINCT to return all rows in my table and only unique address fields?|||I think that a group statement might accomplish this??
as in
select f_name from table group by f_name
I re-read your post...
address validation is a trick...
the address field can be set up many ways, and the street
type designation can also be setup in a whole slew
of different ways...
what does your address field look like (sample data)
thanks
tony|||Soundex is a practically useless algorithm.
You can select distinct First/Last names in a subquery, but then which address would you use if the two records do not agree?
Here is one of the simplest methods:select YourTable.*
from YourTable
inner join --DistinctNames
(select Max(PrimaryKey) as PrimaryKey
from YourTable
group by FirstName,
LastName) DistinctNames
on YourTable.PrimaryKey = DistinctNames.PrimaryKey|||You da' Blindman! Thanks, that's exactly what I needed.|||I hate to post an extension to the question in the same place, but here goes. My owners are listed more than once if they own more than once parcel of land. What I need to do next is continue the merge to each only once, but add up their land acreage amounts and total for each person. Thoughts anyone? Thanks in advance.sql
Subscribe to:
Posts (Atom)