Showing posts with label pull. Show all posts
Showing posts with label pull. Show all posts

Wednesday, March 28, 2012

Finding Duplicate Names in a Simple Table

This is probably so easy it will be stupid but I cannot get anything to
work.
I need to find, from one table, all duplicate names. I pull the entire list
like this:
SELECT ID, First_Name + ' ' + Last_Name, Date_of_Birth
FROM Attendants
What I need from this is a list where the names of the clients appear more
than once. I know there has to be an easy way to do this. Any quick help'SELECT First_Name,last_Name, count(*)
FROM Attendants
group by first_name, last_name
having count(*) > 1
Geoff Chovaz
MCTS: SQL Server 2005
MCITP: Database Administrator
MCITP: Database Developer
"JOHN HARRIS" <harris1113@.fake.com> wrote in message
news:43D97106-6DC7-495F-868A-109B4738A688@.microsoft.com...
> This is probably so easy it will be stupid but I cannot get anything to
> work.
> I need to find, from one table, all duplicate names. I pull the entire
> list like this:
> SELECT ID, First_Name + ' ' + Last_Name, Date_of_Birth
> FROM Attendants
> What I need from this is a list where the names of the clients appear more
> than once. I know there has to be an easy way to do this. Any quick help'|||SELECT ID, RTRIM(a.First_Name) + ' ' + RTRIM(a.Last_Name) , Date_of_Birth
FROM Attendants AS a
WHERE EXISTS (SELECT RTRIM(b.First_Name) + ' ' + RTRIM(b.Last_Name)
FROM Attendants AS b
WHERE a.First_Name = b.First_Name and
a.Last_Name = b.Last_Name
GROUP BY RTRIM(b.First_Name) + ' ' +
RTRIM(b.Last_Name)
HAVING COUNT(*) > 1 )
ORDER BY RTRIM(a.First_Name) + ' ' + RTRIM(a.Last_Name)
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of Books Online from
http://technet.microsoft.com/en-us/sqlserver/bb428874.aspx
"JOHN HARRIS" <harris1113@.fake.com> wrote in message
news:43D97106-6DC7-495F-868A-109B4738A688@.microsoft.com...
> This is probably so easy it will be stupid but I cannot get anything to
> work.
> I need to find, from one table, all duplicate names. I pull the entire
> list like this:
> SELECT ID, First_Name + ' ' + Last_Name, Date_of_Birth
> FROM Attendants
> What I need from this is a list where the names of the clients appear more
> than once. I know there has to be an easy way to do this. Any quick help'|||Thanks Geoff
Works GREAT!
"Geoff Chovaz" <chovaz@.nospam.nospam> wrote in message
news:u0lwu%237%23HHA.1164@.TK2MSFTNGP02.phx.gbl...
> SELECT First_Name,last_Name, count(*)
> FROM Attendants
> group by first_name, last_name
> having count(*) > 1
>
> --
> Geoff Chovaz
> MCTS: SQL Server 2005
> MCITP: Database Administrator
> MCITP: Database Developer
>
> "JOHN HARRIS" <harris1113@.fake.com> wrote in message
> news:43D97106-6DC7-495F-868A-109B4738A688@.microsoft.com...
>> This is probably so easy it will be stupid but I cannot get anything to
>> work.
>> I need to find, from one table, all duplicate names. I pull the entire
>> list like this:
>> SELECT ID, First_Name + ' ' + Last_Name, Date_of_Birth
>> FROM Attendants
>> What I need from this is a list where the names of the clients appear
>> more than once. I know there has to be an easy way to do this. Any quick
>> help'
>

Sunday, February 19, 2012

Filtering with Replication

Hi,
I have to replication a database with a merge replication type
In that database there are 4 tables that I dont need on the subscribers
I use a pull subscriptions
I try to do a publication with out those tables but i received a message
saying that those tables have dependencies on other tables.
What the best way to manage this situation
Those tables are very large and there are long to copy from the Publisher to
the Subscribers.
I try using the row filtering but I think I dont understand what rows
filtering works because after doing few test the replication was reacting the
same way as with out row filtering.
Thanks in advance !
ignore this message and move on. Let me try to explain how this option
works. Suppose you are filtering on the orders table, orders detail table
and the customers table. You filter on the customers table by StateID. The
CustomerID column is also in the orders table, but not in the orders detail
table.
A CA customer moves to a different state (NY) and so the record for this
customer leaves the Customers table. But as there is no filter by state on
the orders table or the orders detail table, his orders remain in CA. Merge
replication is able to walk the DRI and drag the customers order, and order
details rows with him when he moves to NY from CA in something called
partition realignment.
If you are only replicating a single table, merge walks the DRI and tells
you that the related records are not going to move with this customer which
probably is not what you want.
This is a very complex topic so if you need more info, please post back.
Hilary Cotter
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
"GC" <GC@.discussions.microsoft.com> wrote in message
news:FA0E0960-370C-41B6-B5E4-533DACA4FC06@.microsoft.com...
> Hi,
> I have to replication a database with a merge replication type
> In that database there are 4 tables that I dont need on the subscribers
> I use a pull subscriptions
> I try to do a publication with out those tables but i received a message
> saying that those tables have dependencies on other tables.
> What the best way to manage this situation
> Those tables are very large and there are long to copy from the Publisher
> to
> the Subscribers.
> I try using the row filtering but I think I dont understand what rows
> filtering works because after doing few test the replication was reacting
> the
> same way as with out row filtering.
> Thanks in advance !
>
>
>