Showing posts with label names. Show all posts
Showing posts with label names. Show all posts

Tuesday, March 27, 2012

Comparing Tables and Columns Between Two Databases

Hi,

I have a two databases that may be similar but are not identical.I would like to compare the table and column names of the two databases to find out where they differ.Are there any tools that would help me in this task?In Oracle I would compare the meta data of the two databases in a select clause.Can we do the same thing in MS SQL?

Thanks in advance,

Dave

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=23054 should get you what you are looking.

Comparing Strings (Advanced Soundex)

Hello,

I need to compare movie names from two systems. In both systems these names are entered manually by operators. I would like to compare them and give a rating on how close these names are equal.

Stripping special characters, and spaces is just not enough. It can happen that they key in sligthly different names. I've tried to use soundex but as we have over 15000 movie titles over the years i'm getting to many equal soundexes to use this as a comparison key.

Any ideas if there are techniques to do this ...

Kind Regards

See if these will help you out any:

http://www.sqlservercentral.com/columnists/mcoles/sql2000dbatoolkitpart2.asp

http://www.sqlservercentral.com/columnists/mcoles/sql2000dbatoolkitpart3.asp

Thursday, March 22, 2012

Comparing Databases

Hello,
I would like write a tool which will compare two databases
and check for differences, so can someone well me
1. Where are the database names stored
2. Where the column names are stored
3. Where the code for the views is stored
4. Where the code for the Store Procedures is stored
5. Where the code for the functions, defaults ect.
I would rather not use INFORMATION_SCHEMA views as they
look to be very database specific.
I know there are tools to do this but my company isn't
buying, and yes I have told them how much they will save
if we buy rather than make ;)
PeterCheck out:
http://www.sql-server-performance.c...mparison_sp.asp
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:954101c3eb05$dc090b90$a101280a@.phx.gbl...
quote:

> Hello,
> I would like write a tool which will compare two databases
> and check for differences, so can someone well me
> 1. Where are the database names stored
> 2. Where the column names are stored
> 3. Where the code for the views is stored
> 4. Where the code for the Store Procedures is stored
> 5. Where the code for the functions, defaults ect.
> I would rather not use INFORMATION_SCHEMA views as they
> look to be very database specific.
> I know there are tools to do this but my company isn't
> buying, and yes I have told them how much they will save
> if we buy rather than make ;)
> Peter
|||Thanks SriSamp thats perfect
Peter
quote:

>--Original Message--
>Check out:
>http://www.sql-server-

performance.com/vg_database_comparison_sp.asp
quote:

>--
>HTH,
>SriSamp
>Please reply to the whole group only!
>http://www32.brinkster.com/srisamp
>"Peter" <anonymous@.discussions.microsoft.com> wrote in

message
quote:

>news:954101c3eb05$dc090b90$a101280a@.phx.gbl...
databases[QUOTE]
>
>.
>

Comparing Databases

Hello,
I would like write a tool which will compare two databases
and check for differences, so can someone well me
1. Where are the database names stored
2. Where the column names are stored
3. Where the code for the views is stored
4. Where the code for the Store Procedures is stored
5. Where the code for the functions, defaults ect.
I would rather not use INFORMATION_SCHEMA views as they
look to be very database specific.
I know there are tools to do this but my company isn't
buying, and yes I have told them how much they will save
if we buy rather than make ;)
PeterCheck out:
http://www.sql-server-performance.com/vg_database_comparison_sp.asp
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:954101c3eb05$dc090b90$a101280a@.phx.gbl...
> Hello,
> I would like write a tool which will compare two databases
> and check for differences, so can someone well me
> 1. Where are the database names stored
> 2. Where the column names are stored
> 3. Where the code for the views is stored
> 4. Where the code for the Store Procedures is stored
> 5. Where the code for the functions, defaults ect.
> I would rather not use INFORMATION_SCHEMA views as they
> look to be very database specific.
> I know there are tools to do this but my company isn't
> buying, and yes I have told them how much they will save
> if we buy rather than make ;)
> Peter|||Thanks SriSamp thats perfect
Peter
>--Original Message--
>Check out:
>http://www.sql-server-
performance.com/vg_database_comparison_sp.asp
>--
>HTH,
>SriSamp
>Please reply to the whole group only!
>http://www32.brinkster.com/srisamp
>"Peter" <anonymous@.discussions.microsoft.com> wrote in
message
>news:954101c3eb05$dc090b90$a101280a@.phx.gbl...
>> Hello,
>> I would like write a tool which will compare two
databases
>> and check for differences, so can someone well me
>> 1. Where are the database names stored
>> 2. Where the column names are stored
>> 3. Where the code for the views is stored
>> 4. Where the code for the Store Procedures is stored
>> 5. Where the code for the functions, defaults ect.
>> I would rather not use INFORMATION_SCHEMA views as they
>> look to be very database specific.
>> I know there are tools to do this but my company isn't
>> buying, and yes I have told them how much they will save
>> if we buy rather than make ;)
>> Peter
>
>.
>

Tuesday, March 20, 2012

Comparing Column names and indexes

Is there a way to compare tables in 2 different databases to find out if they have the same indexes and column names and keys. Or maybe a tool i dont know about.Again, not sure if this violates the non-commercial nature of this forum, but I use a product called SQL Compare from Red gate Software, Ltd. (www.red-gate.com).

It's definitely worth the price. It will do exactly what you are looking for, plus much more.

Regards,

hmscott

Compare values

I have two tables both with first name and last name fields. I want to create
a query that pulls the names out of table ctct that are not in table ctctws.
I tried this query but does not give me the expected reults
select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
ctctws.c_first_namews
from ctct, ctctws
where c_last_name <> c_last_namews and c_first_name <> c_first_namews
Can anyone suggest away to produce the required result.
I Really appreciate any help
Thanks
select ctct.c_last_name, ctct.c_first_name
FROM ctct
WHERE NOT EXISTS(SELECT NULL FROM ctctws
WHERE c_last_name = c_last_namews and c_first_name = c_first_namews)
Jacco Schalkwijk
SQL Server MVP
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
>I have two tables both with first name and last name fields. I want to
>create
> a query that pulls the names out of table ctct that are not in table
> ctctws.
> I tried this query but does not give me the expected reults
> select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
> ctctws.c_first_namews
> from ctct, ctctws
> where c_last_name <> c_last_namews and c_first_name <> c_first_namews
> Can anyone suggest away to produce the required result.
> I Really appreciate any help
> Thanks
|||I suggest NOT EXISTS. Below is an untested example in which I removed the
ctctws data from the column list since these refer to non-existing rows:
SELECT
ctct.c_last_name,
ctct.c_first_name
FROM ctct
WHERE NOT EXISTS
(
SELECT *
FROM ctctws
WHERE
ctct.c_last_name = ctctws.c_last_namews AND
ctct.c_first_name = ctctws.c_first_namews
)
You could also use LEFT JOIN, but note that unlatching ctctws rows will
contain NULL values.
SELECT
ctct.c_last_name,
ctct.c_first_name,
ctctws.c_last_namews,
c_first_namews
FROM ctct
LEFT JOIN ctctws ON
ctct.c_last_name = ctctws.c_last_namews AND
ctct.c_first_name = ctctws.c_first_namews
WHERE
ctctws.c_last_namews IS NOT NULL
Both of these examples will consider NULL values as unmatching, even if the
values are NULL in both tables. You can add IS NULL criteria to the queries
if you need to consider NULLs as equal for comparison purposes.
Hope this helps.
Dan Guzman
SQL Server MVP
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
>I have two tables both with first name and last name fields. I want to
>create
> a query that pulls the names out of table ctct that are not in table
> ctctws.
> I tried this query but does not give me the expected reults
> select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
> ctctws.c_first_namews
> from ctct, ctctws
> where c_last_name <> c_last_namews and c_first_name <> c_first_namews
> Can anyone suggest away to produce the required result.
> I Really appreciate any help
> Thanks
|||Great that works thanks!!!!! So that shows me the ones that are not there how
do i find the ones that are there?
Thanks!!!
"Dan Guzman" wrote:

> I suggest NOT EXISTS. Below is an untested example in which I removed the
> ctctws data from the column list since these refer to non-existing rows:
> SELECT
> ctct.c_last_name,
> ctct.c_first_name
> FROM ctct
> WHERE NOT EXISTS
> (
> SELECT *
> FROM ctctws
> WHERE
> ctct.c_last_name = ctctws.c_last_namews AND
> ctct.c_first_name = ctctws.c_first_namews
> )
> You could also use LEFT JOIN, but note that unlatching ctctws rows will
> contain NULL values.
> SELECT
> ctct.c_last_name,
> ctct.c_first_name,
> ctctws.c_last_namews,
> c_first_namews
> FROM ctct
> LEFT JOIN ctctws ON
> ctct.c_last_name = ctctws.c_last_namews AND
> ctct.c_first_name = ctctws.c_first_namews
> WHERE
> ctctws.c_last_namews IS NOT NULL
> Both of these examples will consider NULL values as unmatching, even if the
> values are NULL in both tables. You can add IS NULL criteria to the queries
> if you need to consider NULLs as equal for comparison purposes.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Eric" <Eric@.discussions.microsoft.com> wrote in message
> news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
>
>
|||lol never mind i just replaced WHERE NOT EXISTS with WHERE EXISTS
"Eric" wrote:
[vbcol=seagreen]
> Great that works thanks!!!!! So that shows me the ones that are not there how
> do i find the ones that are there?
> Thanks!!!
> "Dan Guzman" wrote:

Compare values

I have two tables both with first name and last name fields. I want to creat
e
a query that pulls the names out of table ctct that are not in table ctctws.
I tried this query but does not give me the expected reults
select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
ctctws.c_first_namews
from ctct, ctctws
where c_last_name <> c_last_namews and c_first_name <> c_first_namews
Can anyone suggest away to produce the required result.
I Really appreciate any help
Thanksselect ctct.c_last_name, ctct.c_first_name
FROM ctct
WHERE NOT EXISTS(SELECT NULL FROM ctctws
WHERE c_last_name = c_last_namews and c_first_name = c_first_namews)
Jacco Schalkwijk
SQL Server MVP
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
>I have two tables both with first name and last name fields. I want to
>create
> a query that pulls the names out of table ctct that are not in table
> ctctws.
> I tried this query but does not give me the expected reults
> select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
> ctctws.c_first_namews
> from ctct, ctctws
> where c_last_name <> c_last_namews and c_first_name <> c_first_namews
> Can anyone suggest away to produce the required result.
> I Really appreciate any help
> Thanks|||I suggest NOT EXISTS. Below is an untested example in which I removed the
ctctws data from the column list since these refer to non-existing rows:
SELECT
ctct.c_last_name,
ctct.c_first_name
FROM ctct
WHERE NOT EXISTS
(
SELECT *
FROM ctctws
WHERE
ctct.c_last_name = ctctws.c_last_namews AND
ctct.c_first_name = ctctws.c_first_namews
)
You could also use LEFT JOIN, but note that unlatching ctctws rows will
contain NULL values.
SELECT
ctct.c_last_name,
ctct.c_first_name,
ctctws.c_last_namews,
c_first_namews
FROM ctct
LEFT JOIN ctctws ON
ctct.c_last_name = ctctws.c_last_namews AND
ctct.c_first_name = ctctws.c_first_namews
WHERE
ctctws.c_last_namews IS NOT NULL
Both of these examples will consider NULL values as unmatching, even if the
values are NULL in both tables. You can add IS NULL criteria to the queries
if you need to consider NULLs as equal for comparison purposes.
Hope this helps.
Dan Guzman
SQL Server MVP
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
>I have two tables both with first name and last name fields. I want to
>create
> a query that pulls the names out of table ctct that are not in table
> ctctws.
> I tried this query but does not give me the expected reults
> select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
> ctctws.c_first_namews
> from ctct, ctctws
> where c_last_name <> c_last_namews and c_first_name <> c_first_namews
> Can anyone suggest away to produce the required result.
> I Really appreciate any help
> Thanks|||Great that works thanks!!!!! So that shows me the ones that are not there ho
w
do i find the ones that are there?
Thanks!!!
"Dan Guzman" wrote:

> I suggest NOT EXISTS. Below is an untested example in which I removed the
> ctctws data from the column list since these refer to non-existing rows:
> SELECT
> ctct.c_last_name,
> ctct.c_first_name
> FROM ctct
> WHERE NOT EXISTS
> (
> SELECT *
> FROM ctctws
> WHERE
> ctct.c_last_name = ctctws.c_last_namews AND
> ctct.c_first_name = ctctws.c_first_namews
> )
> You could also use LEFT JOIN, but note that unlatching ctctws rows will
> contain NULL values.
> SELECT
> ctct.c_last_name,
> ctct.c_first_name,
> ctctws.c_last_namews,
> c_first_namews
> FROM ctct
> LEFT JOIN ctctws ON
> ctct.c_last_name = ctctws.c_last_namews AND
> ctct.c_first_name = ctctws.c_first_namews
> WHERE
> ctctws.c_last_namews IS NOT NULL
> Both of these examples will consider NULL values as unmatching, even if th
e
> values are NULL in both tables. You can add IS NULL criteria to the queri
es
> if you need to consider NULLs as equal for comparison purposes.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Eric" <Eric@.discussions.microsoft.com> wrote in message
> news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
>
>|||lol never mind i just replaced WHERE NOT EXISTS with WHERE EXISTS
"Eric" wrote:
[vbcol=seagreen]
> Great that works thanks!!!!! So that shows me the ones that are not there
how
> do i find the ones that are there?
> Thanks!!!
> "Dan Guzman" wrote:
>

Compare values

I have two tables both with first name and last name fields. I want to create
a query that pulls the names out of table ctct that are not in table ctctws.
I tried this query but does not give me the expected reults
select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
ctctws.c_first_namews
from ctct, ctctws
where c_last_name <> c_last_namews and c_first_name <> c_first_namews
Can anyone suggest away to produce the required result.
I Really appreciate any help
Thanksselect ctct.c_last_name, ctct.c_first_name
FROM ctct
WHERE NOT EXISTS(SELECT NULL FROM ctctws
WHERE c_last_name = c_last_namews and c_first_name = c_first_namews)
--
Jacco Schalkwijk
SQL Server MVP
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
>I have two tables both with first name and last name fields. I want to
>create
> a query that pulls the names out of table ctct that are not in table
> ctctws.
> I tried this query but does not give me the expected reults
> select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
> ctctws.c_first_namews
> from ctct, ctctws
> where c_last_name <> c_last_namews and c_first_name <> c_first_namews
> Can anyone suggest away to produce the required result.
> I Really appreciate any help
> Thanks|||I suggest NOT EXISTS. Below is an untested example in which I removed the
ctctws data from the column list since these refer to non-existing rows:
SELECT
ctct.c_last_name,
ctct.c_first_name
FROM ctct
WHERE NOT EXISTS
(
SELECT *
FROM ctctws
WHERE
ctct.c_last_name = ctctws.c_last_namews AND
ctct.c_first_name = ctctws.c_first_namews
)
You could also use LEFT JOIN, but note that unlatching ctctws rows will
contain NULL values.
SELECT
ctct.c_last_name,
ctct.c_first_name,
ctctws.c_last_namews,
c_first_namews
FROM ctct
LEFT JOIN ctctws ON
ctct.c_last_name = ctctws.c_last_namews AND
ctct.c_first_name = ctctws.c_first_namews
WHERE
ctctws.c_last_namews IS NOT NULL
Both of these examples will consider NULL values as unmatching, even if the
values are NULL in both tables. You can add IS NULL criteria to the queries
if you need to consider NULLs as equal for comparison purposes.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Eric" <Eric@.discussions.microsoft.com> wrote in message
news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
>I have two tables both with first name and last name fields. I want to
>create
> a query that pulls the names out of table ctct that are not in table
> ctctws.
> I tried this query but does not give me the expected reults
> select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
> ctctws.c_first_namews
> from ctct, ctctws
> where c_last_name <> c_last_namews and c_first_name <> c_first_namews
> Can anyone suggest away to produce the required result.
> I Really appreciate any help
> Thanks|||Great that works thanks!!!!! So that shows me the ones that are not there how
do i find the ones that are there?
Thanks!!!
"Dan Guzman" wrote:
> I suggest NOT EXISTS. Below is an untested example in which I removed the
> ctctws data from the column list since these refer to non-existing rows:
> SELECT
> ctct.c_last_name,
> ctct.c_first_name
> FROM ctct
> WHERE NOT EXISTS
> (
> SELECT *
> FROM ctctws
> WHERE
> ctct.c_last_name = ctctws.c_last_namews AND
> ctct.c_first_name = ctctws.c_first_namews
> )
> You could also use LEFT JOIN, but note that unlatching ctctws rows will
> contain NULL values.
> SELECT
> ctct.c_last_name,
> ctct.c_first_name,
> ctctws.c_last_namews,
> c_first_namews
> FROM ctct
> LEFT JOIN ctctws ON
> ctct.c_last_name = ctctws.c_last_namews AND
> ctct.c_first_name = ctctws.c_first_namews
> WHERE
> ctctws.c_last_namews IS NOT NULL
> Both of these examples will consider NULL values as unmatching, even if the
> values are NULL in both tables. You can add IS NULL criteria to the queries
> if you need to consider NULLs as equal for comparison purposes.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Eric" <Eric@.discussions.microsoft.com> wrote in message
> news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
> >I have two tables both with first name and last name fields. I want to
> >create
> > a query that pulls the names out of table ctct that are not in table
> > ctctws.
> > I tried this query but does not give me the expected reults
> >
> > select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
> > ctctws.c_first_namews
> > from ctct, ctctws
> > where c_last_name <> c_last_namews and c_first_name <> c_first_namews
> >
> > Can anyone suggest away to produce the required result.
> > I Really appreciate any help
> >
> > Thanks
>
>|||lol never mind i just replaced WHERE NOT EXISTS with WHERE EXISTS
"Eric" wrote:
> Great that works thanks!!!!! So that shows me the ones that are not there how
> do i find the ones that are there?
> Thanks!!!
> "Dan Guzman" wrote:
> > I suggest NOT EXISTS. Below is an untested example in which I removed the
> > ctctws data from the column list since these refer to non-existing rows:
> >
> > SELECT
> > ctct.c_last_name,
> > ctct.c_first_name
> > FROM ctct
> > WHERE NOT EXISTS
> > (
> > SELECT *
> > FROM ctctws
> > WHERE
> > ctct.c_last_name = ctctws.c_last_namews AND
> > ctct.c_first_name = ctctws.c_first_namews
> > )
> >
> > You could also use LEFT JOIN, but note that unlatching ctctws rows will
> > contain NULL values.
> >
> > SELECT
> > ctct.c_last_name,
> > ctct.c_first_name,
> > ctctws.c_last_namews,
> > c_first_namews
> > FROM ctct
> > LEFT JOIN ctctws ON
> > ctct.c_last_name = ctctws.c_last_namews AND
> > ctct.c_first_name = ctctws.c_first_namews
> > WHERE
> > ctctws.c_last_namews IS NOT NULL
> >
> > Both of these examples will consider NULL values as unmatching, even if the
> > values are NULL in both tables. You can add IS NULL criteria to the queries
> > if you need to consider NULLs as equal for comparison purposes.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > "Eric" <Eric@.discussions.microsoft.com> wrote in message
> > news:3A9452B9-7BE2-4552-9F32-EE12630E2240@.microsoft.com...
> > >I have two tables both with first name and last name fields. I want to
> > >create
> > > a query that pulls the names out of table ctct that are not in table
> > > ctctws.
> > > I tried this query but does not give me the expected reults
> > >
> > > select ctct.c_last_name, ctct.c_first_name, ctctws.c_last_namews,
> > > ctctws.c_first_namews
> > > from ctct, ctctws
> > > where c_last_name <> c_last_namews and c_first_name <> c_first_namews
> > >
> > > Can anyone suggest away to produce the required result.
> > > I Really appreciate any help
> > >
> > > Thanks
> >
> >
> >sqlsql

Monday, March 19, 2012

Compare strings in SQL SERVER 2000

hi,
We have SQL SERVER 2000 database with a table of customers. We would
like to compare the names of customers for double names. We want to
find same names or names that are look like.
for example:
ID NAME ADDRESS
1 John Smith
100 John Smitth
We consider that it is a very useful we have a ranking for these names.
Have you any idea, how can do this ?.Loop LIKE operator in the BOL
SELECT <columns>FROM Table WHERE col LIKE '%Smith%'
Note: In above case SQL Server will not be able to use an index if you have
one on this column
<akoutoulakis@.gmail.com> wrote in message
news:1131368418.663514.264320@.g47g2000cwa.googlegroups.com...
> hi,
> We have SQL SERVER 2000 database with a table of customers. We would
> like to compare the names of customers for double names. We want to
> find same names or names that are look like.
> for example:
> ID NAME ADDRESS
> 1 John Smith
> 100 John Smitth
> We consider that it is a very useful we have a ranking for these names.
> Have you any idea, how can do this ?.
>|||> Loop LIKE operator in the BOL
Sorry ,should be Lookup LIKE operator in the BOL
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23qjQhv54FHA.3540@.TK2MSFTNGP10.phx.gbl...
> Loop LIKE operator in the BOL
> SELECT <columns>FROM Table WHERE col LIKE '%Smith%'
>
> Note: In above case SQL Server will not be able to use an index if you
> have one on this column
>
>
> <akoutoulakis@.gmail.com> wrote in message
> news:1131368418.663514.264320@.g47g2000cwa.googlegroups.com...
>> hi,
>> We have SQL SERVER 2000 database with a table of customers. We would
>> like to compare the names of customers for double names. We want to
>> find same names or names that are look like.
>> for example:
>> ID NAME ADDRESS
>> 1 John Smith
>> 100 John Smitth
>> We consider that it is a very useful we have a ranking for these names.
>> Have you any idea, how can do this ?.
>|||On 7 Nov 2005 05:00:18 -0800, akoutoulakis@.gmail.com wrote:
>hi,
>We have SQL SERVER 2000 database with a table of customers. We would
>like to compare the names of customers for double names. We want to
>find same names or names that are look like.
>for example:
>ID NAME ADDRESS
> 1 John Smith
> 100 John Smitth
>We consider that it is a very useful we have a ranking for these names.
>Have you any idea, how can do this ?.
Hi akoutoulakis,
Searching for duplicates:
SELECT Name, COUNT(*) AS NumOfDups
FROM YourTable
GROUP BY Name
HAVING COUNT(*) > 1
Showing all info for duplicates:
SELECT a.ID, a.Name, a.Address
FROM YourTable AS a
WHERE EXISTS
(SELECT *
FROM YourTable AS b
WHERE b.Name = a.Name
AND b.ID <> a.ID)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thank you for a help.

Compare strings in SQL SERVER 2000

hi,
We have SQL SERVER 2000 database with a table of customers. We would
like to compare the names of customers for double names. We want to
find same names or names that are look like.
for example:
ID NAME ADDRESS
1 John Smith
100 John Smitth
We consider that it is a very useful we have a ranking for these names.
Have you any idea, how can do this ?.Loop LIKE operator in the BOL
SELECT <columns>FROM Table WHERE col LIKE '%Smith%'
Note: In above case SQL Server will not be able to use an index if you have
one on this column
<akoutoulakis@.gmail.com> wrote in message
news:1131368418.663514.264320@.g47g2000cwa.googlegroups.com...
> hi,
> We have SQL SERVER 2000 database with a table of customers. We would
> like to compare the names of customers for double names. We want to
> find same names or names that are look like.
> for example:
> ID NAME ADDRESS
> 1 John Smith
> 100 John Smitth
> We consider that it is a very useful we have a ranking for these names.
> Have you any idea, how can do this ?.
>|||> Loop LIKE operator in the BOL
Sorry ,should be Lookup LIKE operator in the BOL
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23qjQhv54FHA.3540@.TK2MSFTNGP10.phx.gbl...
> Loop LIKE operator in the BOL
> SELECT <columns>FROM Table WHERE col LIKE '%Smith%'
>
> Note: In above case SQL Server will not be able to use an index if you
> have one on this column
>
>
> <akoutoulakis@.gmail.com> wrote in message
> news:1131368418.663514.264320@.g47g2000cwa.googlegroups.com...
>|||On 7 Nov 2005 05:00:18 -0800, akoutoulakis@.gmail.com wrote:

>hi,
>We have SQL SERVER 2000 database with a table of customers. We would
>like to compare the names of customers for double names. We want to
>find same names or names that are look like.
>for example:
>ID NAME ADDRESS
> 1 John Smith
> 100 John Smitth
>We consider that it is a very useful we have a ranking for these names.
>Have you any idea, how can do this ?.
Hi akoutoulakis,
Searching for duplicates:
SELECT Name, COUNT(*) AS NumOfDups
FROM YourTable
GROUP BY Name
HAVING COUNT(*) > 1
Showing all info for duplicates:
SELECT a.ID, a.Name, a.Address
FROM YourTable AS a
WHERE EXISTS
(SELECT *
FROM YourTable AS b
WHERE b.Name = a.Name
AND b.ID <> a.ID)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thank you for a help.

Compare strings in SQL SERVER 2000

hi,
We have SQL SERVER 2000 database with a table of customers. We would
like to compare the names of customers for double names. We want to
find same names or names that are look like.
for example:
ID NAME ADDRESS
1 John Smith
100 John Smitth
We consider that it is a very useful we have a ranking for these names.
Have you any idea, how can do this ?.
Loop LIKE operator in the BOL
SELECT <columns>FROM Table WHERE col LIKE '%Smith%'
Note: In above case SQL Server will not be able to use an index if you have
one on this column
<akoutoulakis@.gmail.com> wrote in message
news:1131368418.663514.264320@.g47g2000cwa.googlegr oups.com...
> hi,
> We have SQL SERVER 2000 database with a table of customers. We would
> like to compare the names of customers for double names. We want to
> find same names or names that are look like.
> for example:
> ID NAME ADDRESS
> 1 John Smith
> 100 John Smitth
> We consider that it is a very useful we have a ranking for these names.
> Have you any idea, how can do this ?.
>
|||> Loop LIKE operator in the BOL
Sorry ,should be Lookup LIKE operator in the BOL
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23qjQhv54FHA.3540@.TK2MSFTNGP10.phx.gbl...
> Loop LIKE operator in the BOL
> SELECT <columns>FROM Table WHERE col LIKE '%Smith%'
>
> Note: In above case SQL Server will not be able to use an index if you
> have one on this column
>
>
> <akoutoulakis@.gmail.com> wrote in message
> news:1131368418.663514.264320@.g47g2000cwa.googlegr oups.com...
>
|||On 7 Nov 2005 05:00:18 -0800, akoutoulakis@.gmail.com wrote:

>hi,
>We have SQL SERVER 2000 database with a table of customers. We would
>like to compare the names of customers for double names. We want to
>find same names or names that are look like.
>for example:
>ID NAME ADDRESS
> 1 John Smith
> 100 John Smitth
>We consider that it is a very useful we have a ranking for these names.
>Have you any idea, how can do this ?.
Hi akoutoulakis,
Searching for duplicates:
SELECT Name, COUNT(*) AS NumOfDups
FROM YourTable
GROUP BY Name
HAVING COUNT(*) > 1
Showing all info for duplicates:
SELECT a.ID, a.Name, a.Address
FROM YourTable AS a
WHERE EXISTS
(SELECT *
FROM YourTable AS b
WHERE b.Name = a.Name
AND b.ID <> a.ID)
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thank you for a help.

Friday, February 10, 2012

Combo box to exclude blank input

Hi
I have a combo box that displays a list of company names. Some entries do
not have a company name on the form so the textbox remains blank. Therefore
in the combo box there are alot of blanks in the list. How do I get the
combo box to just list out the company names without the blanks?
At the moment I have this:
SELECT Contacts.ID, Contacts.CompanyName
FROM Contacts;
Thanks in advance
SeanThe following will exclude NULL or blank CompanyName rows:
SELECT Contacts.ID, Contacts.CompanyName
FROM Contacts
WHERE
Contacts.CompanyName IS NOT NULL AND
Contacts.CompanyName <> '';
Hope this helps.
Dan Guzman
SQL Server MVP
"Sean" <Sean@.discussions.microsoft.com> wrote in message
news:9930ACDB-8E70-45B8-94B1-89A8DF57B60F@.microsoft.com...
> Hi
> I have a combo box that displays a list of company names. Some entries do
> not have a company name on the form so the textbox remains blank.
> Therefore
> in the combo box there are alot of blanks in the list. How do I get the
> combo box to just list out the company names without the blanks?
> At the moment I have this:
> SELECT Contacts.ID, Contacts.CompanyName
> FROM Contacts;
> Thanks in advance
> Sean|||Isn't there a Company table that, by definition, wouldn't have empty
company names?
If not, then one should be added - basic normalization.
Sean wrote:
> Hi
> I have a combo box that displays a list of company names. Some entries do
> not have a company name on the form so the textbox remains blank. Therefor
e
> in the combo box there are alot of blanks in the list. How do I get the
> combo box to just list out the company names without the blanks?
> At the moment I have this:
> SELECT Contacts.ID, Contacts.CompanyName
> FROM Contacts;
> Thanks in advance
> Sean