Showing posts with label client. Show all posts
Showing posts with label client. Show all posts

Thursday, March 29, 2012

Data Structure Advice

Hello,
I am in the process of redesigning a database for client. The advice I need
is how to design a set of tables to reflect what they current use a single
table for.
They have a table that has records that reflect hierarchal data. For
example, they have fields called Level 1, Level 2, Level 3, and Level 4. The
data in Level 1 is repeated many many times. As is Level 2, but not as often,
and so on. Here are examples of types of data found in this table:
- record 1 will have "building" in Level 1, and nothing in the other fields.
- record 2 will have "building" in Level 1 and "Manufacturing in Level 2,
and nothing in the rest of the fields.
- record 3 will have the same in Level 1 and Level 2 but include "office" in
Level 3.
I would like to design a data structure that will not only normalize the
data, but also allow for a dynamic number of levels. Currently, because the
structure is flat, the maximum number of levels is 4.
Thanks in advance!
Jack
"Jack" <Jack@.discussions.microsoft.com> wrote in message
news:E9151293-4B0A-4370-844B-53FCF1752ED6@.microsoft.com...
> I would like to design a data structure that will not only normalize the
> data, but also allow for a dynamic number of levels. Currently, because
the
> structure is flat, the maximum number of levels is 4.
Jack,
Depending on your definition of "dynamic", that may not be possible.
A normalized version of what you described would have one table for
Buildings, then a table for Floors (or whatever the level 2 is) with a
foreign key referencing the PK of the Buildings table, then a table for
Offices, with a FK referencing the PK of the Floors table, etc.
More levels could be added to the hierarchy at any time by simply adding
more tables (and, possibly, an addition FK column to the top level table if,
for instance, you had clusters of buildings at different locations).
If, on the other hand, your definition of "dynamic" is that the number of
levels could change at any time by someone inserting or deleting a row,
that's not possible with a normalized structure. Any structure that does
attempt to implement that kind of dynamism for different types will violate
1NF, as you'll be forced to represent differing types (e.g. a Building key
and a Floor key) in the same column. In addition, there's no real win here
because different entities require different attributes. If someone needs
to add, for instance, a Locations level to the hierarchy, that level will
not share the same attributes as Buildings, Floors, or Offices, and
therefore you will still be required to add a new table or new columns.
|||There is a topic in BOL titled "Expanding Hierarchies" that may be of
interest. Searching the NGs will also yield many discussions of
hierarchical data (and the issues with representing and querying the data).
"Jack" <Jack@.discussions.microsoft.com> wrote in message
news:E9151293-4B0A-4370-844B-53FCF1752ED6@.microsoft.com...
> Hello,
> I am in the process of redesigning a database for client. The advice I
need
> is how to design a set of tables to reflect what they current use a single
> table for.
> They have a table that has records that reflect hierarchal data. For
> example, they have fields called Level 1, Level 2, Level 3, and Level 4.
The
> data in Level 1 is repeated many many times. As is Level 2, but not as
often,
> and so on. Here are examples of types of data found in this table:
> - record 1 will have "building" in Level 1, and nothing in the other
fields.
> - record 2 will have "building" in Level 1 and "Manufacturing in Level 2,
> and nothing in the rest of the fields.
> - record 3 will have the same in Level 1 and Level 2 but include "office"
in
> Level 3.
> I would like to design a data structure that will not only normalize the
> data, but also allow for a dynamic number of levels. Currently, because
the
> structure is flat, the maximum number of levels is 4.
> Thanks in advance!
> Jack

Data Structure Advice

Hello,
I am in the process of redesigning a database for client. The advice I need
is how to design a set of tables to reflect what they current use a single
table for.
They have a table that has records that reflect hierarchal data. For
example, they have fields called Level 1, Level 2, Level 3, and Level 4. The
data in Level 1 is repeated many many times. As is Level 2, but not as often
,
and so on. Here are examples of types of data found in this table:
- record 1 will have "building" in Level 1, and nothing in the other fields.
- record 2 will have "building" in Level 1 and "Manufacturing in Level 2,
and nothing in the rest of the fields.
- record 3 will have the same in Level 1 and Level 2 but include "office" in
Level 3.
I would like to design a data structure that will not only normalize the
data, but also allow for a dynamic number of levels. Currently, because the
structure is flat, the maximum number of levels is 4.
Thanks in advance!
Jack"Jack" <Jack@.discussions.microsoft.com> wrote in message
news:E9151293-4B0A-4370-844B-53FCF1752ED6@.microsoft.com...
> I would like to design a data structure that will not only normalize the
> data, but also allow for a dynamic number of levels. Currently, because
the
> structure is flat, the maximum number of levels is 4.
Jack,
Depending on your definition of "dynamic", that may not be possible.
A normalized version of what you described would have one table for
Buildings, then a table for Floors (or whatever the level 2 is) with a
foreign key referencing the PK of the Buildings table, then a table for
Offices, with a FK referencing the PK of the Floors table, etc.
More levels could be added to the hierarchy at any time by simply adding
more tables (and, possibly, an addition FK column to the top level table if,
for instance, you had clusters of buildings at different locations).
If, on the other hand, your definition of "dynamic" is that the number of
levels could change at any time by someone inserting or deleting a row,
that's not possible with a normalized structure. Any structure that does
attempt to implement that kind of dynamism for different types will violate
1NF, as you'll be forced to represent differing types (e.g. a Building key
and a Floor key) in the same column. In addition, there's no real win here
because different entities require different attributes. If someone needs
to add, for instance, a Locations level to the hierarchy, that level will
not share the same attributes as Buildings, Floors, or Offices, and
therefore you will still be required to add a new table or new columns.|||There is a topic in BOL titled "Expanding Hierarchies" that may be of
interest. Searching the NGs will also yield many discussions of
hierarchical data (and the issues with representing and querying the data).
"Jack" <Jack@.discussions.microsoft.com> wrote in message
news:E9151293-4B0A-4370-844B-53FCF1752ED6@.microsoft.com...
> Hello,
> I am in the process of redesigning a database for client. The advice I
need
> is how to design a set of tables to reflect what they current use a single
> table for.
> They have a table that has records that reflect hierarchal data. For
> example, they have fields called Level 1, Level 2, Level 3, and Level 4.
The
> data in Level 1 is repeated many many times. As is Level 2, but not as
often,
> and so on. Here are examples of types of data found in this table:
> - record 1 will have "building" in Level 1, and nothing in the other
fields.
> - record 2 will have "building" in Level 1 and "Manufacturing in Level 2,
> and nothing in the rest of the fields.
> - record 3 will have the same in Level 1 and Level 2 but include "office"
in
> Level 3.
> I would like to design a data structure that will not only normalize the
> data, but also allow for a dynamic number of levels. Currently, because
the
> structure is flat, the maximum number of levels is 4.
> Thanks in advance!
> Jacksql

Thursday, March 22, 2012

Data Removal Real?

I have a situation where my client wants to ensure that data which is removed from a SQL Server database is truly removed. That is, if I delete a record, or delete data from a row, can I be sure that the data is truly gone and that it's not just the internal B-Tree pointers that were removed? Can I trust that someone with access to the .mdb file could not perform some binary pattern matching on the file and find the data that I assumed was deleted (regardless of how difficult that task would be)? I'm using SQL Server 2000. Thanks in advance.

The data is deleted.

However, depending upon your Recovery model, it may be 'hanging' around in the TRANSACTION LOG file for awhile, and anyone with access (and permissions) to the TRANSACTION LOG file, and one of several third party tools, may be able to inspect the deleted data.

(It's best, before they show up with the subpoenas, to backup and restore - and delete any saved backups and transaction logs, and the use a DOD approved sector wiping utility and burn the tapes... But of course, that is not a good thing to be caught having done...) Wink

|||

Ok, thanks. So, I should look for a recovery model that doesn't use logging? This implies no recoverable transactions, but that would be ok.

(Side note, I'm not worried about subpoenas. Foreign governments are the perceived risk.)

|||

Simple recovery model has the shortest logging latency.

However, that means no data recovery since the last FULL BACKUP.

It seems that you may need to better secure the server ...

|||

I wasn’t sure about this one, so I asked the experts and this is what they replied back:

all the deletes are only logical … The only way to get rid of the data for sure is to DTS to a new (clean) database.

They mentioned some SQL Server 2005 SP2 feature for Common Criteria (CC) that is used to clear the information on the pages, but again, they mentioned it is only a logical deletion.

Arnie, it may be possible that you were talking about this feature, can you please confirm? Unfortunately I have limited knowledge on this particular area myself.

Thanks a lot,

-Raul Garcia

SDE/T

SQL Server Engine

Tuesday, March 20, 2012

Data region in RS allows only 1 data source - virtual cube solutions?

I have a report requiring two different data sources be compared in one
data region. For example, I'm comparing a measure for a client against
a national average. The client measure comes from one cube and the
national average is stored in a sql database. RS won't allow two data
sources to be used in a data region unless you can use an aggregate
function on the second data source. I attempted to solve this by
creating a cube for the second data source (national averages) and then
a virtual cube to make one data source (i.e. one MDX statement from the
virtual cube per data region) for RS. The orginal MDX used for the
first data source required slicing by dimensions not included in the
national average cube and visa versa. I have been able to get the
correct answer for each cube before combining into the virtual cube,
but I can not get the measures correctly in the virtual if, for each
measure, I need to slice by a dimension that is not shared. I haven't
been able to find the information anywhere (and I've tried internet and
2 books), but because my measures are not correct I assume that a
virtual cube in only useful if the correct results are obtained by
slicing into only the shared dimensions? Are there any other solutions
to the rediculous RS limitation of only being able to provide one data
source to a data region? What we they thinking'oops, should have used spell check before submitting. it is a
ridiculous RS limitation.|||Hi Carrie,
I believe you can refer to more than one datasource from a data region such
as a table. Try putting in two data sources on a report and drag data from
them both into a table (note, you have to set the tables data source to one
data set).
see how that goes
<cwilliams@.choosehmc.com> wrote in message
news:1104767162.584780.225260@.z14g2000cwz.googlegroups.com...
> I have a report requiring two different data sources be compared in one
> data region. For example, I'm comparing a measure for a client against
> a national average. The client measure comes from one cube and the
> national average is stored in a sql database. RS won't allow two data
> sources to be used in a data region unless you can use an aggregate
> function on the second data source. I attempted to solve this by
> creating a cube for the second data source (national averages) and then
> a virtual cube to make one data source (i.e. one MDX statement from the
> virtual cube per data region) for RS. The orginal MDX used for the
> first data source required slicing by dimensions not included in the
> national average cube and visa versa. I have been able to get the
> correct answer for each cube before combining into the virtual cube,
> but I can not get the measures correctly in the virtual if, for each
> measure, I need to slice by a dimension that is not shared. I haven't
> been able to find the information anywhere (and I've tried internet and
> 2 books), but because my measures are not correct I assume that a
> virtual cube in only useful if the correct results are obtained by
> slicing into only the shared dimensions? Are there any other solutions
> to the rediculous RS limitation of only being able to provide one data
> source to a data region? What we they thinking'
>|||The answer is to create a calculated member using the ValidMeasure
function for each measure in the virtual cube. Just in case anyone is
interested...sql

Data Pump

My client is using a sql server 7.0 to store realtime data like heat,temp,pressure etc inserted every second.He wants me to provide a solution to transfer the summarised data to oracle server on a regular basis..say once on every 5 min..
what approach i should take...help me out plsSet up a DTS package to send the data from SQL Server to Oracle.
Create a scheduled job to run the package every five minutes.|||In SQL Server 2000 replication can solve your problem but I do not know about SQL Server 7.0.

Blindman's idea is easy & will be work for you...|||I can't recommend that anybody include DTS packages as part of any long-term solution now that SQL Server 2005 no longer supports them.|||I can't recommend that anybody include DTS packages as part of any long-term solution now that SQL Server 2005 no longer supports them.I suppose that by the strictest definition that is true, but I tend to think of SSIS (http://msdn.microsoft.com/SQL/bi/integration/default.aspx) as being the descendant of DTS.

-PatP|||Descendent, bastard child, unholy spawn, however you want to call it...|||Descendent, bastard child, unholy spawn, however you want to call it...So, how do you really feel about SSIS? You don't have to hold back, we understand. ;)

-PatP|||select @.Functionality/@.Documentation

----
Msg 8134, Level 16, State 1, Line 1
Divide by zero error encountered.

Data Providers Gone Missing

Our server has been upgraded to W/2003 and SQLSP3 has just been applied, and
also the Progress client utilities have been un-installed/re-installed. Now I
cannot create a linked server because the data providers have all
disappeared. I don't know which of the above has caused this, but does
anyone know how to get them back? I can see them all in the registry. Should
we try re-applying SP3?
Just for the record, I managed to fix this one. Seems the W2000->2003
upgrade did not update the oledb32.dll file from 2.71 to 2.8. Copied over
the correct version and all working again now.
Another effect of this was the following error when running DTS wizard:-
"The procedure entry point GetTextExtentPointI could not be located in the
dynamic link library MSDART.DLL."
Thanks to the following page for pointing me in the right direction:-
http://www.sqlnewsgroups.net/link.as...700/rh8763.htm
Unfortunately the KB article this refers to is no longer available.
"MrTim" wrote:

> Our server has been upgraded to W/2003 and SQLSP3 has just been applied, and
> also the Progress client utilities have been un-installed/re-installed. Now I
> cannot create a linked server because the data providers have all
> disappeared. I don't know which of the above has caused this, but does
> anyone know how to get them back? I can see them all in the registry. Should
> we try re-applying SP3?

Data Providers Gone Missing

Our server has been upgraded to W/2003 and SQLSP3 has just been applied, and
also the Progress client utilities have been un-installed/re-installed. Now
I
cannot create a linked server because the data providers have all
disappeared. I don't know which of the above has caused this, but does
anyone know how to get them back? I can see them all in the registry. Shoul
d
we try re-applying SP3?Just for the record, I managed to fix this one. Seems the W2000->2003
upgrade did not update the oledb32.dll file from 2.71 to 2.8. Copied over
the correct version and all working again now.
Another effect of this was the following error when running DTS wizard:-
"The procedure entry point GetTextExtentPointI could not be located in the
dynamic link library MSDART.DLL."
Thanks to the following page for pointing me in the right direction:-
http://www.sqlnewsgroups.net/link.a...7
63.htm
Unfortunately the KB article this refers to is no longer available.
"MrTim" wrote:

> Our server has been upgraded to W/2003 and SQLSP3 has just been applied, a
nd
> also the Progress client utilities have been un-installed/re-installed. No
w I
> cannot create a linked server because the data providers have all
> disappeared. I don't know which of the above has caused this, but does
> anyone know how to get them back? I can see them all in the registry. Sho
uld
> we try re-applying SP3?sql

Data Providers Gone Missing

Our server has been upgraded to W/2003 and SQLSP3 has just been applied, and
also the Progress client utilities have been un-installed/re-installed. Now I
cannot create a linked server because the data providers have all
disappeared. I don't know which of the above has caused this, but does
anyone know how to get them back? I can see them all in the registry. Should
we try re-applying SP3?Just for the record, I managed to fix this one. Seems the W2000->2003
upgrade did not update the oledb32.dll file from 2.71 to 2.8. Copied over
the correct version and all working again now.
Another effect of this was the following error when running DTS wizard:-
"The procedure entry point GetTextExtentPointI could not be located in the
dynamic link library MSDART.DLL."
Thanks to the following page for pointing me in the right direction:-
http://www.sqlnewsgroups.net/link.aspx?url=http://www.jsifaq.com/SUBR/tip8700/rh8763.htm
Unfortunately the KB article this refers to is no longer available.
"MrTim" wrote:
> Our server has been upgraded to W/2003 and SQLSP3 has just been applied, and
> also the Progress client utilities have been un-installed/re-installed. Now I
> cannot create a linked server because the data providers have all
> disappeared. I don't know which of the above has caused this, but does
> anyone know how to get them back? I can see them all in the registry. Should
> we try re-applying SP3?

Sunday, March 11, 2012

Data Modeling Question: One Entity or Two

I am evaluating an existing MS Access database for a new client - with the
intent to migrate it to SQL Server and possibly change/improve the
relational database design in the process.
The client is a medical specialty office in which patients show up with lab
results taken by their primary care physician (PCP) prior to the patient
showing up at my client's specialty office. My client's office then proceeds
to take additional lab measurements over time. The data collected by the PCP
and my client's office is practically the same.
My client's existing MS Access database stores this information in two
tables - one for labs taken at the PCP office (and apparently only the most
recent set of results prior to the patient showing up at my client's
office); and another table for labs taken at my client's office (and
measured over time). In the existing database these two tables have similar
(almost identical) columns.
The client's in-house DBA sees these tables as representing two entities,
not one (one entity is "last set of labs measured by the PCP" and the other
entity is "labs measured in-house; over time"). I understand all these lab
results as one entity ("lab results"); and therefore we can/should move all
this data into one table when we migrate the data to the new SQL Server
database.
What do you think? Do these lab results represent one entity or two?
FWIW: The business managers do not differentiate between the two types of
labs (measured by PCP vs in-house).
Thanks!Sounds to me like one entity. I would add a column to one existing table
(possibly a CHAR(1)) that specified the source of the results. Be careful
in how you approach it though, as they might understand some arcane medical
regulation as specifying that they have to keep these data items physically
separated in some fashion (usually a misunderstanding of the regulations by
management, but I've seen stranger things...)
"Jeff" <A@.B.COM> wrote in message
news:%23n1oTddjGHA.3496@.TK2MSFTNGP02.phx.gbl...
>I am evaluating an existing MS Access database for a new client - with the
>intent to migrate it to SQL Server and possibly change/improve the
>relational database design in the process.
> The client is a medical specialty office in which patients show up with
> lab results taken by their primary care physician (PCP) prior to the
> patient showing up at my client's specialty office. My client's office
> then proceeds to take additional lab measurements over time. The data
> collected by the PCP and my client's office is practically the same.
> My client's existing MS Access database stores this information in two
> tables - one for labs taken at the PCP office (and apparently only the
> most recent set of results prior to the patient showing up at my client's
> office); and another table for labs taken at my client's office (and
> measured over time). In the existing database these two tables have
> similar (almost identical) columns.
> The client's in-house DBA sees these tables as representing two entities,
> not one (one entity is "last set of labs measured by the PCP" and the
> other entity is "labs measured in-house; over time"). I understand all
> these lab results as one entity ("lab results"); and therefore we
> can/should move all this data into one table when we migrate the data to
> the new SQL Server database.
> What do you think? Do these lab results represent one entity or two?
> FWIW: The business managers do not differentiate between the two types of
> labs (measured by PCP vs in-house).
> Thanks!
>|||A good case for horizontal partitioning. With sql2k, I would keep them as 2
seperate entities (i.e 2 tables). But if you're on sql2k5, you might want to
look into table partitioning. There is definitely a performance gained by
partitioning them 'cuz the data for each will be smaller. Though, it would
require a union/join to look for data in both entities - a minor drawback in
this case.
-oj
"Jeff" <A@.B.COM> wrote in message
news:%23n1oTddjGHA.3496@.TK2MSFTNGP02.phx.gbl...
>I am evaluating an existing MS Access database for a new client - with the
>intent to migrate it to SQL Server and possibly change/improve the
>relational database design in the process.
> The client is a medical specialty office in which patients show up with
> lab results taken by their primary care physician (PCP) prior to the
> patient showing up at my client's specialty office. My client's office
> then proceeds to take additional lab measurements over time. The data
> collected by the PCP and my client's office is practically the same.
> My client's existing MS Access database stores this information in two
> tables - one for labs taken at the PCP office (and apparently only the
> most recent set of results prior to the patient showing up at my client's
> office); and another table for labs taken at my client's office (and
> measured over time). In the existing database these two tables have
> similar (almost identical) columns.
> The client's in-house DBA sees these tables as representing two entities,
> not one (one entity is "last set of labs measured by the PCP" and the
> other entity is "labs measured in-house; over time"). I understand all
> these lab results as one entity ("lab results"); and therefore we
> can/should move all this data into one table when we migrate the data to
> the new SQL Server database.
> What do you think? Do these lab results represent one entity or two?
> FWIW: The business managers do not differentiate between the two types of
> labs (measured by PCP vs in-house).
> Thanks!
>|||Jeff wrote:
> [...] Do these lab results represent one entity or two?
I would use separate tables only if there is some information that
should be handled differently, for example if:
- the in-house lab results should be linked to a table about payments
(whereas the PCP resuls should not);
- the in-house lab results should have a MeasurerID column that refers
to our Employees table;
- etc.
Think about the such differences between the two types of lab results;
of course, if there are very few differences, they can be handled by
using a null-able column in the unified table (along some check
constraints, to enforce that for a particular type that column should
not be null). However, if there are more differences, having a lot of
null-able columns would not be "a Good Thing", so a two-tables approach
may be better in such a case.
Razvan|||If one table only has the most recent results, and the other tracks history,
you may be better off keeping them seperate. It could be a nightmare
cleaning up the "old" rows from the PCP if they are in the same table with
the history data. Also, if the foreign keys behave differently in these two
tables then you would want to keep them seperate.
"Jeff" <A@.B.COM> wrote in message
news:%23n1oTddjGHA.3496@.TK2MSFTNGP02.phx.gbl...
> I am evaluating an existing MS Access database for a new client - with the
> intent to migrate it to SQL Server and possibly change/improve the
> relational database design in the process.
> The client is a medical specialty office in which patients show up with
lab
> results taken by their primary care physician (PCP) prior to the patient
> showing up at my client's specialty office. My client's office then
proceeds
> to take additional lab measurements over time. The data collected by the
PCP
> and my client's office is practically the same.
> My client's existing MS Access database stores this information in two
> tables - one for labs taken at the PCP office (and apparently only the
most
> recent set of results prior to the patient showing up at my client's
> office); and another table for labs taken at my client's office (and
> measured over time). In the existing database these two tables have
similar
> (almost identical) columns.
> The client's in-house DBA sees these tables as representing two entities,
> not one (one entity is "last set of labs measured by the PCP" and the
other
> entity is "labs measured in-house; over time"). I understand all these lab
> results as one entity ("lab results"); and therefore we can/should move
all
> this data into one table when we migrate the data to the new SQL Server
> database.
> What do you think? Do these lab results represent one entity or two?
> FWIW: The business managers do not differentiate between the two types of
> labs (measured by PCP vs in-house).
> Thanks!
>|||Jeff wrote:
> I am evaluating an existing MS Access database for a new client - with the
> intent to migrate it to SQL Server and possibly change/improve the
> relational database design in the process.
> The client is a medical specialty office in which patients show up with la
b
> results taken by their primary care physician (PCP) prior to the patient
> showing up at my client's specialty office. My client's office then procee
ds
> to take additional lab measurements over time. The data collected by the P
CP
> and my client's office is practically the same.
> My client's existing MS Access database stores this information in two
> tables - one for labs taken at the PCP office (and apparently only the mos
t
> recent set of results prior to the patient showing up at my client's
> office); and another table for labs taken at my client's office (and
> measured over time). In the existing database these two tables have simila
r
> (almost identical) columns.
> The client's in-house DBA sees these tables as representing two entities,
> not one (one entity is "last set of labs measured by the PCP" and the othe
r
> entity is "labs measured in-house; over time"). I understand all these lab
> results as one entity ("lab results"); and therefore we can/should move al
l
> this data into one table when we migrate the data to the new SQL Server
> database.
> What do you think? Do these lab results represent one entity or two?
> FWIW: The business managers do not differentiate between the two types of
> labs (measured by PCP vs in-house).
> Thanks!
In principle if two potential entities have the same attributes then
they are only one entity.
In fact you can go further and say that entities that overlap (sharing
a common key and a common subset of non-key attributes) should be
represented as a single entity.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Thanks for the feedback Jim. Can you please clarify "if the foreign keys
behave differently"?
What do you mean by "behave differently?
Thanks!
"Jim Underwood" <james.underwoodATfallonclinic.com> wrote in message
news:eKkGd9ljGHA.3588@.TK2MSFTNGP02.phx.gbl...
> If one table only has the most recent results, and the other tracks
> history,
> you may be better off keeping them seperate. It could be a nightmare
> cleaning up the "old" rows from the PCP if they are in the same table with
> the history data. Also, if the foreign keys behave differently in these
> two
> tables then you would want to keep them seperate.
> "Jeff" <A@.B.COM> wrote in message
> news:%23n1oTddjGHA.3496@.TK2MSFTNGP02.phx.gbl...
> lab
> proceeds
> PCP
> most
> similar
> other
> all
>|||If the two tables have different constraints, or foreign keys that point to
different tables, with different validation, then two tables is probably a
good idea.
If all of the columns in the tables share the same validation, against the
same tables, then one makes sense.
Here is one consideration, however...
If you did put all the data in one table, how do you enforce the business
rule that the PCP data have only one row and the internal data be allowed
history? Also, you need to discern between the two in the app. If you can
accomplish both of those (I'm sure there are many ways) then you should be
fine with one table.
OK, that was two considerations...
If I am being too vague I apologize. Without truly understanding the
business reason for keeping the data separate to begin with it is hard to
say exactly what should be done. From your own description one table seems
to make sense, but if their in house DBA were to explain it my opinion might
change.
"Jordan Richard" <A@.B.COM> wrote in message
news:eUY2mKqjGHA.3496@.TK2MSFTNGP02.phx.gbl...
> Thanks for the feedback Jim. Can you please clarify "if the foreign keys
> behave differently"?
> What do you mean by "behave differently?
> Thanks!
>
> "Jim Underwood" <james.underwoodATfallonclinic.com> wrote in message
> news:eKkGd9ljGHA.3588@.TK2MSFTNGP02.phx.gbl...
with
patient
the
entities,
of
>|||"Jim Underwood" <james.underwoodATfallonclinic.com> wrote in message
news:O6Ve%238ujGHA.4660@.TK2MSFTNGP03.phx.gbl...
> If you did put all the data in one table, how do you enforce the business
> rule that the PCP data have only one row and the internal data be allowed
> history? Also, you need to discern between the two in the app. If you
> can
> accomplish both of those (I'm sure there are many ways) then you should be
> fine with one table.
You can address issue #1 via trigger. #2 can be addressed by adding a
column that specifies where the data came from (i.e., CHAR(1), 'L' = Local
source, 'P' = Partner source, etc.) Of course existing apps would have to
be modified.
Another consideration here might be how often you currently have to combine
the data from the two tables in a query. If you combine them often for
reporting or other purposes, combining them on the server makes sense. If
you don't ever combine them when querying, combining them might not be a
high priority.|||>> What do you think? Do these lab results represent one entity or two? ..
FWIW: The business managers do not differentiate between the two types of l
abs (measured by PCP vs in-house). <<
What is the LOGICAL difference between them? Apparently, none. Ergo,
you use one table and column for the lab_type. Leave this encoding
open enough that you can extend it lately, when add other sources.

Data Modeling Question

I'm designing a database for a medical group that must keep track of various
"People"
Some are doctors and some are patients.
The client currently categorizes patients according to the type of
procedure(s) they have been seen for (e..g, "Jane is a Botox patient because
she had Botox injections" while "Ralph is a hair transplant patient because
he's had hair transplants." And on and on it goes). These procedures are
obviously not mutually exclusive given that any given patient can have more
than one type of procedure.
As I see the situation we have [Patients] and [Procedures]. We do NOT have
[patient types] even though that's how the client understands them. We just
have patients who have various procedures.
My whiz bang plan is to simply have a many-to-many relationship between
[Patients] and [Procedures].
This will work fine for identifying the so called "patient types"... just
SELECT... WHERE a Procedure Type is "botox" (however I encode that) to get
"the Botox patients".
Question 1: What would be a good way to classify a patient who has not yet
had any procedure? Say Bambi comes in and gets scheduled for Botox. The
doctors would want her to show up on reports as a "Botox patient" even
though she hasn't yet had the procedure.
Question 2: Given that [Doctors] and [Patients] are fundamentally different
"things" in this database, is it reasonable to have two tables - one for
Doctors and another for Patients... or is it recommended to have one table
("People") and then have some "PersonType" column that flags the person as a
doctor or a patient (and then have a bunch of NULLS for columns not relevant
to each row's designated "person type"). The one-table approach seems kind
of ugly. Just wanted some feedback on this before I go off and implement.
Thank you for your time and consideration.
-JThis has similarities to the database I work with, which is hr/payroll
data. There is a table of 'positions' (job titles a person can have).
You may have an equivalent 'procedures' table. Procedures table would
likely have budget/costs associated with the procedure.
Another table would have the procedure history for a person. A person
could have multiple records in that table, each would have a key for
the person, the procedure name, the procedure key (for joining to
'procedures' table). This table would have a startdate and enddate for
the procedure. A person who is scheduled, but has not yet had the
procedure merely has a futuredated record in this table (based on
startdate). When the procedure is done, you give the record an
enddate.
Doctors and patients all belong in the same table b/c a doctor could be
a patient and vice versa. Each person has their own unique id and also
a second field which is the id of that persons PCP. So if you have:
name, uniqueid, PCPid
dr smith, 1, 0
dr jones, 2, 0
sick guy,3,1
dr williams,4,2
This means that sick guy goes to dr. smith. Dr williams goes to Dr.
Jones.
You likely WILL need a flag field that lets you clearly determine who
is a doc ('flagdoc' that has y/n or 1/0 for everyone).
Based on similar relationships, this is how my company does it.
Theoretically, maybe you don't have to put the procedure name in the
procedure history, but it's nice having it there.
HTH,
wayne|||>> is it reasonable to have two tables - one for Doctors and another for Pat
ients... or is it recommended to have one table ("People") <<
Doctors and patients are logically different, so I would scrape the
idea of a general "Peoiple" table. Where is the "Treatments" table
that would show the dates (scheduled, actual, etc.), location,
doctor(s), etc. for Bambi's Botox?
As a patient. The assorted procedures done to them are events and not
attributes of the patient himself.|||> Question 1: What would be a good way to classify a patient who has not yet
> had any procedure? Say Bambi comes in and gets scheduled for Botox. The
> doctors would want her to show up on reports as a "Botox patient" even
> though she hasn't yet had the procedure.
I would suggest you document people throughout their lifecycle with you. So
when the patient comes in, planning to get Botox, a row is created in the
Patients and PatientProcedures table. Another table would be related to the
patientProcedures table that would document the status of the relationship.
Planned, Scheduled, Occurred, FollowUp, OopsPatientLooksLikeJoanRivers and
so on (I will assume you are with the jokes since you started it out
with "Bambi" "). Then you have the best of both scenarios.

> Question 2: Given that [Doctors] and [Patients] are fundamentally
> different "things" in this database, is it reasonable to have two tables -
> one for Doctors and another for Patients... or is it recommended to have
> one table ("People") and then have some "PersonType" column that flags the
> person as a doctor or a patient (and then have a bunch of NULLS for
> columns not relevant to each row's designated "person type"). The
> one-table approach seems kind of ugly. Just wanted some feedback on this
> before I go off and implement.
Tough call. I would would not suggest the one table approach, but a table
for generic "people" attributes, and another for patient attributes. I
wouldn't have a PersonType in this case because a person could be both (the
key of the two subordinate tables would be the same as for the Person table
so a person could only be mapped once.) The existance of a row in the
patient table would indicate that the person is a patient. (Will you have
nurses, sleep makers (can't spell anesthesiologist) and such. Particularly
for billing and/or scheduling I would imagine.)
Now you have everything you need (I think) you can tell the type of patient
immediately, including their status "Planned" "Botox", "Scheduled" "Hair
Transplant" and after > 1 procedures takes place: "Planned" "Repeat"
"Botox". Then they can get specific about the types of patient that they
are looking at.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Jordan R." <A@.B.COM> wrote in message
news:ux0URV4LGHA.3100@.tk2msftngp13.phx.gbl...
> I'm designing a database for a medical group that must keep track of
> various "People"
> Some are doctors and some are patients.
> The client currently categorizes patients according to the type of
> procedure(s) they have been seen for (e..g, "Jane is a Botox patient
> because she had Botox injections" while "Ralph is a hair transplant
> patient because he's had hair transplants." And on and on it goes). These
> procedures are obviously not mutually exclusive given that any given
> patient can have more than one type of procedure.
> As I see the situation we have [Patients] and [Procedures]. We do NOT have
> [patient types] even though that's how the client understands them. We
> just have patients who have various procedures.
> My whiz bang plan is to simply have a many-to-many relationship between
> [Patients] and [Procedures].
> This will work fine for identifying the so called "patient types"... just
> SELECT... WHERE a Procedure Type is "botox" (however I encode that) to get
> "the Botox patients".
> Question 1: What would be a good way to classify a patient who has not yet
> had any procedure? Say Bambi comes in and gets scheduled for Botox. The
> doctors would want her to show up on reports as a "Botox patient" even
> though she hasn't yet had the procedure.
> Question 2: Given that [Doctors] and [Patients] are fundamentally
> different "things" in this database, is it reasonable to have two tables -
> one for Doctors and another for Patients... or is it recommended to have
> one table ("People") and then have some "PersonType" column that flags the
> person as a doctor or a patient (and then have a bunch of NULLS for
> columns not relevant to each row's designated "person type"). The
> one-table approach seems kind of ugly. Just wanted some feedback on this
> before I go off and implement.
> Thank you for your time and consideration.
> -J
>|||wouldn't it be pretty common for a doctor to also be a patient of
his/her own group practice'
The futuredated record mentioned above could be a bit dangerous b/c
people will definitely back out on things. Our place has a whole
module for 'applicants'. If they are hired, then they get records for
jobs, etc. The data model for people who say they 'want to do something
in the future' could be pretty complex...|||The more I ponder, the one table layout works well when the patient
only goes to one doctor and does not switch too often. We use the
above layout for employees and their dependents (which is a nice,
static relationship).
It does sound like the patients at your place can have numerous doctors
work on them over the course of time. Your db revolves around the
procedure--which can have one patient, one or two docs. Splitting out
may well be the best way to go.|||>> wouldn't it be pretty common for a doctor to also be a patient of his/her
own group practice? <<
No, not in the US; insurnace companies would go nuts. Can you say
"FRAUD!!"?
So we need both an actuial and schedule appointment date. Sounds like
a good source for stats and predictions!|||Louis Davidson wrote:
> Tough call. I would would not suggest the one table approach, but a table
> for generic "people" attributes, and another for patient attributes.
Which country? The generic "people" approach seems to be the one taken
by the UK's National Health Service (the world's largest?) In the
interest of standards, they have published their data dictionary:
http://www.nhsia.nhs.uk/datastandar...
.asp?shownav=1
Jamie.|||Yes, but a person in one country is still a person in another. I would
suggest that whatever this person needs would be the best approach. At a
minimum First Name, Last Name, mailing address, etc, perhaps some form of Id
Number, perhaps. The basics.
Some of these things in their list would be very offensive to Americans.
For some reason we will give up our "tax" number (social security number,
which is becoming too much of a citizen id number)
Then the patient would have a file number, perhaps if all records are stored
in a paper format, medical information, etc. This table would be related to
the appointment calendar, billing.
Then doctors information, abilities, schedule, etc.
By no means is this a required way to do it. Having two tables with some
minor overlap of information is not horrible when the two concepts are going
to have little interaction (for example, if you had to balance a doctor's
appointment schedule as a patient AND a doctor, this would be essential.)
Frankly if the only overlapping information in a medical system is that a
doctor is entered as a patient of another doctor AND a doctor of patients,
the world would rejoice at not having to explain why they want to see the
doctor 10 times.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"onedaywhen" <jamiecollins@.xsmail.com> wrote in message
news:1139819374.327665.281610@.f14g2000cwb.googlegroups.com...
> Louis Davidson wrote:
> Which country? The generic "people" approach seems to be the one taken
> by the UK's National Health Service (the world's largest?) In the
> interest of standards, they have published their data dictionary:
> http://www.nhsia.nhs.uk/datastandar...t.asp?shownav=1
> Jamie.
> --
>|||Louis Davidson wrote:
> Some of these things in their list would be very offensive to Americans.
> For some reason we will give up our "tax" number (social security number,
> which is becoming too much of a citizen id number)
That's why I opened with, 'Which country?" :) If the OP (or other
interested reader) is in the UK then choosing to follow the NHS model
is one way of resolving the quandary.
FWIW here we seem to be moving in the opposite direction e.g. identity
cards for all :(
Jamie

Thursday, March 8, 2012

Data mining licensing requirements

I am developing a data mining solution for a client using SQL 2005.

Do they have to purchase a separate license for a replicated environment? Like a hot site....

Thanks, ]

BI Joe

Data Mining is part of SQL Server and has the same licensing requirements. E.g. if it's on the web, than you need the per processor license, etc.

I'm not an expert on all of the licensing issues, but, in short, there's no difference between using the relational engine, reporting services, analysis services, etc - the licensing requirements are the same.

Wednesday, March 7, 2012

Data Mining Client for Excel

Is it at all possible to use this tool without any connection to SQL Server (mine data in Excel Worksheets only)? Or is it required to connect to SQL Server?
From reading the documentation, one minute I get the feeling this is possible, then the next section I get a feeling it's not. Can anyone help? Thanks.

We can't play data mining with Office 2007 without a connection to Analysis Service Server.

By Start -> Programs -> Microsoft SQL Server 2005 DM Add-ins ->
Server Configuration Utility you have to choose a server that contain a data mining database.

|||

Gigi is correct,

You need connection to SQL Server to use Excel add-ins.

|||

Actually the answer is Yes and No. Yes you can mine the data directly in your Excel worksheet, but no, you can't do it without a connection to SQL Server Analysis Services.

With the data mining addins you can mine data in worksheets or in databases, but the "mining" takes place on an Analysis Services server. So you need a connection, regardless of where the data is present.

Many people are getting licences for their local machines for SQL Server to do this disconnected.

HTH

-Jamie

Friday, February 24, 2012

Data Loss in SQL Server 2000

I set up a server for a client with Small Business Server
2000. Everything is working well except for SQl server.
The database was designed by a third party. Said third
party imported the database and everthing looked ok. The
database uses Access XP as its front end. I have the
latest patches on all parts of the server including SQL
2000 and the lastest ODBC drivers on all desktops (around
5-7, all running XP prof or 2000). Now onto the problem.
Users have been experiencing data ie records they update
sometimes do not show the changes when check them later
(anywhere from a couple of hours to next day). I have
been called out to look for network problem or server
overload etc. Everything I check out is fine. Third party
has not really looked into problems with logs etc and
keeps bringing up things for me to do. How can I check
for problems with the database and what tools should I
use? I do not have much experience with SQL server as
this is my only client that uses it. I am very
experienced with server and exchange. Any help would be
greatly appreciated."Tim" <tim@.buckeyemicro.com> wrote in message
news:133e01c37316$c70b57f0$a301280a@.phx.gbl...
> I set up a server for a client with Small Business Server
> 2000. Everything is working well except for SQl server.
> The database was designed by a third party. Said third
> party imported the database and everthing looked ok. The
> database uses Access XP as its front end. I have the
> latest patches on all parts of the server including SQL
> 2000 and the lastest ODBC drivers on all desktops (around
> 5-7, all running XP prof or 2000). Now onto the problem.
> Users have been experiencing data ie records they update
> sometimes do not show the changes when check them later
> (anywhere from a couple of hours to next day). I have
> been called out to look for network problem or server
> overload etc. Everything I check out is fine. Third party
> has not really looked into problems with logs etc and
> keeps bringing up things for me to do. How can I check
> for problems with the database and what tools should I
> use? I do not have much experience with SQL server as
> this is my only client that uses it. I am very
> experienced with server and exchange. Any help would be
> greatly appreciated.
>
First, SqlServer doesn't loose updates. Period. It just doesn't happen.
So 99% this is an application problem, either an outright bug, or a
concurrency problem like users overwriting each others changes.
You could use a tool like Lumigent's log explorer
(http://www.lumigent.com/products/le_sql/le_sql.htm) to see what happened to
the changes. Or you could start a SQLProfiler trace and just let it run to
a file on the server, and dig through it later for evidence of the missing
updates. Your best hope is to get the users to reproduce the error:
concentrate on having multiple users making changes that might interfere
with each other. If you can describe exactly how to reproduce the problem
the software vendor should be able to fix it.
So in short, this isn't your problem, but you may have to play dective to
get the ball rolling. But you've got to fight when the third party puts the
ball back in your court. This is a common tactic that software people use
to deflect blame or stall for time (at least so I've heard ;)). Be helpful,
but don't be a pushover. SQLServer doesn't just loose updates. Only
applications can do that. If there were any kind of network problem or
serious server problem the users would be getting errors, not lost updates.
David

Data just disappears

I have a client running SQL server 2000 on Windows 2003. Yesterday
data just started disappearing. It is being accessed by asp via his
website and when the data is being inserted it seems to all of a
sudden drop all data in the table. Earlier in the day the table
disappeared all together. Anyone ever see this?

LSThis can happen if the website is being "hacked". This is done via SQL
Injection, where by DDL language is used in the fields that are on the
screen. With the clever use of quotes and semi-colons, a hacker can issue a
TRUNCATE TABLE or DROP table.

Oscar...

"Len Svitenko" <its_goodtobethe_king@.yahoo.com> wrote in message
news:6092a26a.0401181707.3134bde1@.posting.google.c om...
> I have a client running SQL server 2000 on Windows 2003. Yesterday
> data just started disappearing. It is being accessed by asp via his
> website and when the data is being inserted it seems to all of a
> sudden drop all data in the table. Earlier in the day the table
> disappeared all together. Anyone ever see this?
> LS|||its_goodtobethe_king@.yahoo.com (Len Svitenko) wrote in message news:<6092a26a.0401181707.3134bde1@.posting.google.com>...
> I have a client running SQL server 2000 on Windows 2003. Yesterday
> data just started disappearing. It is being accessed by asp via his
> website and when the data is being inserted it seems to all of a
> sudden drop all data in the table. Earlier in the day the table
> disappeared all together. Anyone ever see this?
> LS

You can use Profiler to trace all SQL to the server, and see where the
DELETE or TRUNCATE statements are coming from. It may be a genuine
error in application code, or it may be malicious exploitation of a
security hole.

Simon|||Have a look at Erland's site which has more info on this :

http://www.algonet.se/~sommar/dynam...html#Security2

"Oscar Santiesteban Jr." <oscarsantiesteban@.worldnet.att.net> wrote in message news:<KjIOb.31844$VS4.992004@.bgtnsc04-news.ops.worldnet.att.net>...
> This can happen if the website is being "hacked". This is done via SQL
> Injection, where by DDL language is used in the fields that are on the
> screen. With the clever use of quotes and semi-colons, a hacker can issue a
> TRUNCATE TABLE or DROP table.
> Oscar...
> "Len Svitenko" <its_goodtobethe_king@.yahoo.com> wrote in message
> news:6092a26a.0401181707.3134bde1@.posting.google.c om...
> > I have a client running SQL server 2000 on Windows 2003. Yesterday
> > data just started disappearing. It is being accessed by asp via his
> > website and when the data is being inserted it seems to all of a
> > sudden drop all data in the table. Earlier in the day the table
> > disappeared all together. Anyone ever see this?
> > LS

Friday, February 17, 2012

data import question

Hi,
I am writing a script for a client to update TableA using the data in
TableB. I know how to write an UPDATE query to do this. But the client wants
an ability to add or remove fields that they update using this script. I
know I can do this by letting the client enter the names of the source and
destination fields in a custom table and generate a dynamic query to update
the provided columns. But the problem is there are large number of fields
and sql has the limit of 8000 characters on variables write a dynamic query.
So writing a dynamic query is not an easy option either. So my question is
how do I solve this problem. Please not that we need to update 150+ fields
in 500,000+ records using this script. So it also needs to be as fast as
possible.
Thanks in advance.helpful sql wrote:

> Hi,
> I am writing a script for a client to update TableA using the data in
> TableB. I know how to write an UPDATE query to do this. But the client wan
ts
> an ability to add or remove fields that they update using this script. I
> know I can do this by letting the client enter the names of the source and
> destination fields in a custom table and generate a dynamic query to updat
e
> the provided columns. But the problem is there are large number of fields
> and sql has the limit of 8000 characters on variables write a dynamic quer
y.
> So writing a dynamic query is not an easy option either. So my question is
> how do I solve this problem. Please not that we need to update 150+ fields
> in 500,000+ records using this script. So it also needs to be as fast as
> possible.
> Thanks in advance.
Here's one possibility:
UPDATE A
SET
col1 = CASE WHEN @.col1 = 'Y' THEN B.col1 ELSE A.col1 END,
col2 = CASE WHEN @.col2 = 'Y' THEN B.col2 ELSE A.col2 END,
col3 = CASE WHEN @.col3 = 'Y' THEN B.col3 ELSE A.col3 END
..
WHERE ...?
David Portas
SQL Server MVP
--|||Dynamic SQL can take several variables to exceed the 8000 byte limit.
DECLARE @.X1 VARCHAR(8000), @.X2 VARCHAR(8000)
EXEC(@.X1 + @.X2)
Andrew J. Kelly SQL MVP
"helpful sql" <nospam@.stopspam.com> wrote in message
news:eC2Vg$IDGHA.3748@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I am writing a script for a client to update TableA using the data in
> TableB. I know how to write an UPDATE query to do this. But the client
> wants an ability to add or remove fields that they update using this
> script. I know I can do this by letting the client enter the names of the
> source and destination fields in a custom table and generate a dynamic
> query to update the provided columns. But the problem is there are large
> number of fields and sql has the limit of 8000 characters on variables
> write a dynamic query. So writing a dynamic query is not an easy option
> either. So my question is how do I solve this problem. Please not that we
> need to update 150+ fields in 500,000+ records using this script. So it
> also needs to be as fast as possible.
> Thanks in advance.
>

Data Header on every page

I have a report grouped by accounts. Can I generate something like this:-
Joe Blogs Inc... [Header]
--
Client: Microsoft Group Page 1/5
Total Page 1/25
Account No:- 123456 Address :- 123 Infinate Loop
Account Name : MSFT Location :- Competition Headquarters
Name | Date | Item | Code | Desc | Qty | Price
MSFT 6/7/05 123 3456 Netscape 1 $2
________________________________________________ [5 pages later]
Client :- GOOGLE Group Page 1/20
Total Page 6/25
Account No:- 876543 Address :- 678 Google Valley
Account Name : GOOG Location :- Googlville
Name | Date | Item | Code | Desc | Qty | Price
GOOG 6/7/05 123 3456 Netscape 1 $2
--
Page 6 - 25 [Footer]
Above shows 2 groups, each group has a small synopsis before the detail data
begins. I have been racking my brains trying to get RS to do just this. I
intend to have 1 dataset which contains all this data(joined in the sql),
however I have no problems having 2 datasets, 1 for Detail and 2 for Synopsis
if it is so requried - I just need directions on how to join the 2.
Hope ya'll can help...It would probably be best to use only one dataset. It looks like you can do
all of this in a single table with groups and merged columns. If not, then
a list with an embedded table.
Paul Turley
"d pak" <dipakb@.exchnage.ml.com> wrote in message
news:414D274C-BB96-42DD-9BD0-B5DE142EC79A@.microsoft.com...
>I have a report grouped by accounts. Can I generate something like this:-
> Joe Blogs Inc... [Header]
> --
> Client: Microsoft Group Page 1/5
> Total Page 1/25
> Account No:- 123456 Address :- 123 Infinate Loop
> Account Name : MSFT Location :- Competition Headquarters
> Name | Date | Item | Code | Desc | Qty | Price
> MSFT 6/7/05 123 3456 Netscape 1 $2
> ________________________________________________ [5 pages later]
> Client :- GOOGLE Group Page 1/20
> Total Page 6/25
> Account No:- 876543 Address :- 678 Google Valley
> Account Name : GOOG Location :- Googlville
> Name | Date | Item | Code | Desc | Qty | Price
> GOOG 6/7/05 123 3456 Netscape 1 $2
> --
> Page 6 - 25 [Footer]
> Above shows 2 groups, each group has a small synopsis before the detail
> data
> begins. I have been racking my brains trying to get RS to do just this. I
> intend to have 1 dataset which contains all this data(joined in the sql),
> however I have no problems having 2 datasets, 1 for Detail and 2 for
> Synopsis
> if it is so requried - I just need directions on how to join the 2.
> Hope ya'll can help...

data from multiple tables

Hi
I have 6 databases and each has a table sys_items. My client asked me
to create a list of all the unique items from these tables from all
the databases.
select a. item, b, item, c.item, d.item, e.item, f.item
from a, b, c, d, e,f
there are a few common items in each table. so it means i want all the
common and unique items in my list.
any idea? suggestions?
please let me know
thanks
Ajit
Try:
select
a.item
from
DatabaseA.dbo.sys_items a
join DatabaseB.dbo.sys_items b on b.Item = a.Item
join DatabaseC.dbo.sys_items c on c.Item = a.Item
join DatabaseD.dbo.sys_items d on d.Item = a.Item
join DatabaseE.dbo.sys_items e on e.Item = a.Item
join DatabaseF.dbo.sys_items f on f.Item = a.Item
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Ajit - The Scorpio" <ajitscorpio@.gmail.com> wrote in message
news:1184705626.221486.182570@.e16g2000pri.googlegr oups.com...
Hi
I have 6 databases and each has a table sys_items. My client asked me
to create a list of all the unique items from these tables from all
the databases.
select a. item, b, item, c.item, d.item, e.item, f.item
from a, b, c, d, e,f
there are a few common items in each table. so it means i want all the
common and unique items in my list.
any idea? suggestions?
please let me know
thanks
Ajit
|||I think he wants to find the items that are common to all DB's.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:GKednS7PK8RAsADbnZ2dnUVZ8sKlnZ2d@.giganews.com ...
"Ajit - The Scorpio" <ajitscorpio@.gmail.com> wrote in message
news:1184705626.221486.182570@.e16g2000pri.googlegr oups.com...
> Hi
> I have 6 databases and each has a table sys_items. My client asked me
> to create a list of all the unique items from these tables from all
> the databases.
> select a. item, b, item, c.item, d.item, e.item, f.item
> from a, b, c, d, e,f
> there are a few common items in each table. so it means i want all the
> common and unique items in my list.
>
SELECT item FROM a.dbo.tbl UNION
SELECT item FROM b.dbo.tbl UNION
SELECT item FROM c.dbo.tbl UNION
SELECT item FROM d.dbo.tbl UNION
SELECT item FROM e.dbo.tbl UNION
SELECT item FROM f.dbo.tbl ;
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
|||Thanks guys.. I tried Union and it worked...

data from multiple tables

Hi
I have 6 databases and each has a table sys_items. My client asked me
to create a list of all the unique items from these tables from all
the databases.
select a. item, b, item, c.item, d.item, e.item, f.item
from a, b, c, d, e,f
there are a few common items in each table. so it means i want all the
common and unique items in my list.
any idea' suggestions'
please let me know
thanks
Ajit"Ajit - The Scorpio" <ajitscorpio@.gmail.com> wrote in message
news:1184705626.221486.182570@.e16g2000pri.googlegroups.com...
> Hi
> I have 6 databases and each has a table sys_items. My client asked me
> to create a list of all the unique items from these tables from all
> the databases.
> select a. item, b, item, c.item, d.item, e.item, f.item
> from a, b, c, d, e,f
> there are a few common items in each table. so it means i want all the
> common and unique items in my list.
>
SELECT item FROM a.dbo.tbl UNION
SELECT item FROM b.dbo.tbl UNION
SELECT item FROM c.dbo.tbl UNION
SELECT item FROM d.dbo.tbl UNION
SELECT item FROM e.dbo.tbl UNION
SELECT item FROM f.dbo.tbl ;
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Try:
select
a.item
from
DatabaseA.dbo.sys_items a
join DatabaseB.dbo.sys_items b on b.Item = a.Item
join DatabaseC.dbo.sys_items c on c.Item = a.Item
join DatabaseD.dbo.sys_items d on d.Item = a.Item
join DatabaseE.dbo.sys_items e on e.Item = a.Item
join DatabaseF.dbo.sys_items f on f.Item = a.Item
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Ajit - The Scorpio" <ajitscorpio@.gmail.com> wrote in message
news:1184705626.221486.182570@.e16g2000pri.googlegroups.com...
Hi
I have 6 databases and each has a table sys_items. My client asked me
to create a list of all the unique items from these tables from all
the databases.
select a. item, b, item, c.item, d.item, e.item, f.item
from a, b, c, d, e,f
there are a few common items in each table. so it means i want all the
common and unique items in my list.
any idea' suggestions'
please let me know
thanks
Ajit|||I think he wants to find the items that are common to all DB's.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:GKednS7PK8RAsADbnZ2dnUVZ8sKlnZ2d@.gi
ganews.com...
"Ajit - The Scorpio" <ajitscorpio@.gmail.com> wrote in message
news:1184705626.221486.182570@.e16g2000pri.googlegroups.com...
> Hi
> I have 6 databases and each has a table sys_items. My client asked me
> to create a list of all the unique items from these tables from all
> the databases.
> select a. item, b, item, c.item, d.item, e.item, f.item
> from a, b, c, d, e,f
> there are a few common items in each table. so it means i want all the
> common and unique items in my list.
>
SELECT item FROM a.dbo.tbl UNION
SELECT item FROM b.dbo.tbl UNION
SELECT item FROM c.dbo.tbl UNION
SELECT item FROM d.dbo.tbl UNION
SELECT item FROM e.dbo.tbl UNION
SELECT item FROM f.dbo.tbl ;
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Thanks guys.. I tried Union and it worked...

data from multiple tables

Hi
I have 6 databases and each has a table sys_items. My client asked me
to create a list of all the unique items from these tables from all
the databases.
select a. item, b, item, c.item, d.item, e.item, f.item
from a, b, c, d, e,f
there are a few common items in each table. so it means i want all the
common and unique items in my list.
any idea' suggestions'
please let me know
thanks
Ajit"Ajit - The Scorpio" <ajitscorpio@.gmail.com> wrote in message
news:1184705626.221486.182570@.e16g2000pri.googlegroups.com...
> Hi
> I have 6 databases and each has a table sys_items. My client asked me
> to create a list of all the unique items from these tables from all
> the databases.
> select a. item, b, item, c.item, d.item, e.item, f.item
> from a, b, c, d, e,f
> there are a few common items in each table. so it means i want all the
> common and unique items in my list.
>
SELECT item FROM a.dbo.tbl UNION
SELECT item FROM b.dbo.tbl UNION
SELECT item FROM c.dbo.tbl UNION
SELECT item FROM d.dbo.tbl UNION
SELECT item FROM e.dbo.tbl UNION
SELECT item FROM f.dbo.tbl ;
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Try:
select
a.item
from
DatabaseA.dbo.sys_items a
join DatabaseB.dbo.sys_items b on b.Item = a.Item
join DatabaseC.dbo.sys_items c on c.Item = a.Item
join DatabaseD.dbo.sys_items d on d.Item = a.Item
join DatabaseE.dbo.sys_items e on e.Item = a.Item
join DatabaseF.dbo.sys_items f on f.Item = a.Item
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"Ajit - The Scorpio" <ajitscorpio@.gmail.com> wrote in message
news:1184705626.221486.182570@.e16g2000pri.googlegroups.com...
Hi
I have 6 databases and each has a table sys_items. My client asked me
to create a list of all the unique items from these tables from all
the databases.
select a. item, b, item, c.item, d.item, e.item, f.item
from a, b, c, d, e,f
there are a few common items in each table. so it means i want all the
common and unique items in my list.
any idea' suggestions'
please let me know
thanks
Ajit|||I think he wants to find the items that are common to all DB's.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:GKednS7PK8RAsADbnZ2dnUVZ8sKlnZ2d@.giganews.com...
"Ajit - The Scorpio" <ajitscorpio@.gmail.com> wrote in message
news:1184705626.221486.182570@.e16g2000pri.googlegroups.com...
> Hi
> I have 6 databases and each has a table sys_items. My client asked me
> to create a list of all the unique items from these tables from all
> the databases.
> select a. item, b, item, c.item, d.item, e.item, f.item
> from a, b, c, d, e,f
> there are a few common items in each table. so it means i want all the
> common and unique items in my list.
>
SELECT item FROM a.dbo.tbl UNION
SELECT item FROM b.dbo.tbl UNION
SELECT item FROM c.dbo.tbl UNION
SELECT item FROM d.dbo.tbl UNION
SELECT item FROM e.dbo.tbl UNION
SELECT item FROM f.dbo.tbl ;
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Thanks guys.. I tried Union and it worked...

data from multiple databases

Hi
I have 6 databases and each has sys_items table. my client ask me to
create an Excel file with all the unique items from all these
databases.
e.g. get all the items from database1.sys_items then merge all the
unique items from database2.sys_items and so on
i hope you guys are getting my point.
Please advice
thanks
Ajit
I am trying to create a sql query and i tried to explain giving an
example. i.e. get all items from database1.sys_items and then get all
unique items from other databases with same table name.
i dont have any sql query at the moment and that is my question in
this post.
i am not getting any error as i dont have anything to execute at this
moment.
Thanks
Ajit
>
>
>
>
> Replied in the previous thread.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> -- Hide quoted text -
> - Show quoted text -