Showing posts with label implement. Show all posts
Showing posts with label implement. Show all posts

Thursday, March 29, 2012

Alternate names

I need to implement support for alternate names on the database Im working on.
When a user looks up: Antony Bigglesworth the query would return both: Antony Bigglesworth as well as Tony Bigglesworth, would both exist.
Anyone has a best practice on this or has done this before?You mean hat it returns every first name that is a substring of the name you look for?
Something like:

Where SearchString Like '%' + FirstNameField + '%'

I believe that would return, Antony, Tony, Ton, A, but not Abby and George.|||I presume iot is more complex that that yes? "Dick" for "Richard" and "Teddy" for "Edward"?|||I presume iot is more complex that that yes? "Dick" for "Richard" and "Teddy" for "Edward"?

Yes, Antony clearly wasnt the best choice.

I need Richard Bigglesworth to be returned when I look for Dick Bigglesworth!

Thanks for getting back on this.|||Use my fuzzy-search algorithm. It was created to do exactly what you describe.
http://sqlblindman.googlepages.com/fuzzysearchalgorithm

Example:
set nocount on
select dbo.comparetext('Antony Bigglesworth', 'Tony Bigglesworth') as CompareValue1
select dbo.comparetext('Richard Bigglesworth', 'Dick Bigglesworth') as CompareValue2

Results:
CompareValue1
----
94

CompareValue2
----
74|||Thanks Blindman,

That looks great.

I also have to define a group of names which would be specificly checked and collected then returned from the database. Thus, the user would look for "Tony" as the first name, and so all the people with first name "Tony" and all the people with the first name "Anthony" would be returned.

I kind of did it now, created a table where you can add in these name groups, and a small sql script then checks if the sought after first name is in the table, if it is it gets the group id, then cycles through the group collecting all the relevant records then returns them.

Thanks for all the help on this|||To be thorough, you should accept the names "Buddy" and "Pal" and perhaps "Dude" as wild-cards that match any name.|||don't forget "Todd" and "Biff"|||In SoCal, we also have to expand a bit on Blindman's suggestion, since we also have "Duuuuuude!" as well as any name with the suffix "meister" appended (as in "Paulmeister" or "Blindmanmeister").sql

Thursday, March 22, 2012

ALTER TABLE SWITCH PARTITION on a replicated table

A customer wants to implement table partitioning on a replicated table.

They want to hold 13 months of data in the table and roll off the earliest/oldest month to an identical archive table. The table has a date field and partitioning by month makes sense all around.

So SWITCH PARTITION is the obvious solution to this, except for the fact that the table is replicated (transactional w/no subscriber updates).

What are his architectural or practical solutions to using table partitioning and replication?

thx

I'm sorry but i did not understand your question exactly.

Did you mean something like : "What are the benefits of using Table Partitioning with Replication?" ?

Ekrem ?nsoy

MCP, MCDST, MCDBA, MCAD.Net, MCSD.Net, MCSA, MCSE

|||

BOL says that SWITCH PARTITION cannot be used on a replicated table.

So if my customer wants to implement a partition function/scheme and switch a partition out on a monthly basis, it appears that this cannot be done.

What other options would they have to roll data on and off their table on a monthly basis (other than SELECT INTO the archive table followed by a DELETE on the original table)?

thx

|||That is the only option. SWITCH is not supported on replicated tables. The reason for this is very straightforward. A SWITCH operation is a metadata only operation. These do not get picked up by replication and so can not be applied to the subscriber. Since it can not be applied to a subscriber, allowing this operation would create a subscriber which is out of synch with the publisher with no way of putting it back in synch. So, if it is replicated, you have to use either an insert or a select into in order to move the data to the other table and then come back and delete it off the source table thereby allowing it to flow through replication.