Showing posts with label dataset. Show all posts
Showing posts with label dataset. Show all posts

Wednesday, March 28, 2012

How to show two dataset with equal & non equal of multiple selection.

Dear Friends,

In my report, I am having Listbox for users to choose Country, City & Company.
The user can choose Country. Based on the country selection, cities will be listed out.
Based on the city selection, Companies will be listed out.
They can choose companies.

Now, I have to show two set of results.

A. List of Companies as per selection ( dataset with equal to selection )

B. List of Companies which are not selected ( ie dataset with not equal to selection )

I have created a dataset with all companies and filter it by selection. When I tried with the filter option in the Dataset, I am able to check for only one value and not for multiple value. If the selection is one company, then I can filter it. But if they choose 5 companies, I am not not able to filter it. Is there any other option I can try out.


Please advice. Thanks.

warm regards
Rakin
Singapore.

It sounds like you are using RS 2005, since you have multi value report parameters.

On the filter tab, you can set the filter operator to "IN" (this is the last entry in the list of filter operators). Assuming that your Company report parameter is marked as "multi-value", you can then use the following filter settings:

Filter expression: =Fields!CompanyName.Value
Filter operator: IN
Filter value: =Parameters!Company.Value

The IN-filter can automatically deal with multi-value parameters (which represent an array of values).

-- Robert

|||

Thanks Robert.

You are right. I am using RS 2005.

Now, I am able to get the value for the first option. ( with IN )

But I could n't find any NOT IN option in the filter for the second set of results ?

Could you please advice for this ?

Regards
Rakin

|||

Rakin, a "not in" filter is currently not natively supported in Reporting Services. You would need to look into ways of achieving this directly in the query by using the NOT IN clause:

E.g. select * from products where ReorderLevel not IN (@.Level)

I also attached a small sample report at the bottom based on the Northwind database.

-- Robert

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="Northwind">
<DataSourceReference>Northwind</DataSourceReference>
<rd:DataSourceID>9904b9f4-d569-4718-a75a-b7fb657657fd</rd:DataSourceID>
</DataSource>
</DataSources>
<BottomMargin>1in</BottomMargin>
<RightMargin>1in</RightMargin>
<ReportParameters>
<ReportParameter Name="Level">
<DataType>Integer</DataType>
<Prompt>Level</Prompt>
<ValidValues>
<ParameterValues>
<ParameterValue>
<Value>0</Value>
</ParameterValue>
<ParameterValue>
<Value>5</Value>
</ParameterValue>
<ParameterValue>
<Value>10</Value>
</ParameterValue>
<ParameterValue>
<Value>15</Value>
</ParameterValue>
<ParameterValue>
<Value>20</Value>
</ParameterValue>
<ParameterValue>
<Value>25</Value>
</ParameterValue>
<ParameterValue>
<Value>30</Value>
</ParameterValue>
</ParameterValues>
</ValidValues>
<MultiValue>true</MultiValue>
</ReportParameter>
</ReportParameters>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>8.5in</InteractiveWidth>
<rd:SnapToGrid>true</rd:SnapToGrid>
<Body>
<ReportItems>
<Matrix Name="matrix1">
<MatrixColumns>
<MatrixColumn>
<Width>1in</Width>
</MatrixColumn>
</MatrixColumns>
<Left>0.125in</Left>
<RowGroupings>
<RowGrouping>
<Width>1in</Width>
<DynamicRows>
<ReportItems>
<Textbox Name="ReorderLevel">
<rd:DefaultName>ReorderLevel</rd:DefaultName>
<ZIndex>1</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!ReorderLevel.Value</Value>
</Textbox>
</ReportItems>
<Sorting>
<SortBy>
<SortExpression>=Fields!ReorderLevel.Value</SortExpression>
<Direction>Ascending</Direction>
</SortBy>
</Sorting>
<Grouping Name="matrix1_ReorderLevel">
<GroupExpressions>
<GroupExpression>=Fields!ReorderLevel.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicRows>
</RowGrouping>
</RowGroupings>
<ColumnGroupings>
<ColumnGrouping>
<DynamicColumns>
<ReportItems>
<Textbox Name="CategoryID">
<rd:DefaultName>CategoryID</rd:DefaultName>
<ZIndex>2</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!CategoryID.Value</Value>
</Textbox>
</ReportItems>
<Grouping Name="matrix1_CategoryID">
<GroupExpressions>
<GroupExpression>=Fields!CategoryID.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicColumns>
<Height>0.25in</Height>
</ColumnGrouping>
</ColumnGroupings>
<DataSetName>DataSet1</DataSetName>
<Top>0.25in</Top>
<Width>2in</Width>
<Corner>
<ReportItems>
<Textbox Name="textbox1">
<rd:DefaultName>textbox1</rd:DefaultName>
<ZIndex>3</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</Corner>
<Height>0.5in</Height>
<MatrixRows>
<MatrixRow>
<Height>0.25in</Height>
<MatrixCells>
<MatrixCell>
<ReportItems>
<Textbox Name="ProductID">
<rd:DefaultName>ProductID</rd:DefaultName>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Count(Fields!ProductID.Value)</Value>
</Textbox>
</ReportItems>
</MatrixCell>
</MatrixCells>
</MatrixRow>
</MatrixRows>
</Matrix>
</ReportItems>
<Height>1.25in</Height>
</Body>
<rd:ReportID>ed5d6416-a54d-4c50-8568-8f5bae4484cf</rd:ReportID>
<LeftMargin>1in</LeftMargin>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
<CommandText>select * from products where ReorderLevel not IN (@.Level)</CommandText>
<QueryParameters>
<QueryParameter Name="@.Level">
<Value>=Parameters!Level.Value</Value>
</QueryParameter>
</QueryParameters>
<DataSourceName>Northwind</DataSourceName>
</Query>
<Fields>
<Field Name="ProductID">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>ProductID</DataField>
</Field>
<Field Name="ProductName">
<rd:TypeName>System.String</rd:TypeName>
<DataField>ProductName</DataField>
</Field>
<Field Name="SupplierID">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>SupplierID</DataField>
</Field>
<Field Name="CategoryID">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>CategoryID</DataField>
</Field>
<Field Name="QuantityPerUnit">
<rd:TypeName>System.String</rd:TypeName>
<DataField>QuantityPerUnit</DataField>
</Field>
<Field Name="UnitPrice">
<rd:TypeName>System.Decimal</rd:TypeName>
<DataField>UnitPrice</DataField>
</Field>
<Field Name="UnitsInStock">
<rd:TypeName>System.Int16</rd:TypeName>
<DataField>UnitsInStock</DataField>
</Field>
<Field Name="UnitsOnOrder">
<rd:TypeName>System.Int16</rd:TypeName>
<DataField>UnitsOnOrder</DataField>
</Field>
<Field Name="ReorderLevel">
<rd:TypeName>System.Int16</rd:TypeName>
<DataField>ReorderLevel</DataField>
</Field>
<Field Name="Discontinued">
<rd:TypeName>System.Boolean</rd:TypeName>
<DataField>Discontinued</DataField>
</Field>
</Fields>
</DataSet>
</DataSets>
<Width>2.5in</Width>
<InteractiveHeight>11in</InteractiveHeight>
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>

|||

In RS 2005, I have a report with 5 report parameters. Two of those parameters are query based in order to populate drop down lists in the report for the user.

The BUG occurs when the report initialises: the first query based parameter is populated but the second query-based parameter is blank. I select the available values in both parameters and click on the "View Report" button but the same BUG occurs: the first parameter is populated but the second parameter's values are reset. If I select values from both and click the View Report button a few times it will eventually display the report.

Have any of you encountered anything like this?

Niall

How to show two dataset with equal & non equal of multiple selection.

Dear Friends,

In my report, I am having Listbox for users to choose Country, City & Company.
The user can choose Country. Based on the country selection, cities will be listed out.
Based on the city selection, Companies will be listed out.
They can choose companies.

Now, I have to show two set of results.

A. List of Companies as per selection ( dataset with equal to selection )

B. List of Companies which are not selected ( ie dataset with not equal to selection )

I have created a dataset with all companies and filter it by selection. When I tried with the filter option in the Dataset, I am able to check for only one value and not for multiple value. If the selection is one company, then I can filter it. But if they choose 5 companies, I am not not able to filter it. Is there any other option I can try out.


Please advice. Thanks.

warm regards
Rakin
Singapore.

It sounds like you are using RS 2005, since you have multi value report parameters.

On the filter tab, you can set the filter operator to "IN" (this is the last entry in the list of filter operators). Assuming that your Company report parameter is marked as "multi-value", you can then use the following filter settings:

Filter expression: =Fields!CompanyName.Value
Filter operator: IN
Filter value: =Parameters!Company.Value

The IN-filter can automatically deal with multi-value parameters (which represent an array of values).

-- Robert

|||

Thanks Robert.

You are right. I am using RS 2005.

Now, I am able to get the value for the first option. ( with IN )

But I could n't find any NOT IN option in the filter for the second set of results ?

Could you please advice for this ?

Regards
Rakin

|||

Rakin, a "not in" filter is currently not natively supported in Reporting Services. You would need to look into ways of achieving this directly in the query by using the NOT IN clause:

E.g. select * from products where ReorderLevel not IN (@.Level)

I also attached a small sample report at the bottom based on the Northwind database.

-- Robert

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="Northwind">
<DataSourceReference>Northwind</DataSourceReference>
<rd:DataSourceID>9904b9f4-d569-4718-a75a-b7fb657657fd</rd:DataSourceID>
</DataSource>
</DataSources>
<BottomMargin>1in</BottomMargin>
<RightMargin>1in</RightMargin>
<ReportParameters>
<ReportParameter Name="Level">
<DataType>Integer</DataType>
<Prompt>Level</Prompt>
<ValidValues>
<ParameterValues>
<ParameterValue>
<Value>0</Value>
</ParameterValue>
<ParameterValue>
<Value>5</Value>
</ParameterValue>
<ParameterValue>
<Value>10</Value>
</ParameterValue>
<ParameterValue>
<Value>15</Value>
</ParameterValue>
<ParameterValue>
<Value>20</Value>
</ParameterValue>
<ParameterValue>
<Value>25</Value>
</ParameterValue>
<ParameterValue>
<Value>30</Value>
</ParameterValue>
</ParameterValues>
</ValidValues>
<MultiValue>true</MultiValue>
</ReportParameter>
</ReportParameters>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>8.5in</InteractiveWidth>
<rd:SnapToGrid>true</rd:SnapToGrid>
<Body>
<ReportItems>
<Matrix Name="matrix1">
<MatrixColumns>
<MatrixColumn>
<Width>1in</Width>
</MatrixColumn>
</MatrixColumns>
<Left>0.125in</Left>
<RowGroupings>
<RowGrouping>
<Width>1in</Width>
<DynamicRows>
<ReportItems>
<Textbox Name="ReorderLevel">
<rd:DefaultName>ReorderLevel</rd:DefaultName>
<ZIndex>1</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!ReorderLevel.Value</Value>
</Textbox>
</ReportItems>
<Sorting>
<SortBy>
<SortExpression>=Fields!ReorderLevel.Value</SortExpression>
<Direction>Ascending</Direction>
</SortBy>
</Sorting>
<Grouping Name="matrix1_ReorderLevel">
<GroupExpressions>
<GroupExpression>=Fields!ReorderLevel.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicRows>
</RowGrouping>
</RowGroupings>
<ColumnGroupings>
<ColumnGrouping>
<DynamicColumns>
<ReportItems>
<Textbox Name="CategoryID">
<rd:DefaultName>CategoryID</rd:DefaultName>
<ZIndex>2</ZIndex>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!CategoryID.Value</Value>
</Textbox>
</ReportItems>
<Grouping Name="matrix1_CategoryID">
<GroupExpressions>
<GroupExpression>=Fields!CategoryID.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicColumns>
<Height>0.25in</Height>
</ColumnGrouping>
</ColumnGroupings>
<DataSetName>DataSet1</DataSetName>
<Top>0.25in</Top>
<Width>2in</Width>
<Corner>
<ReportItems>
<Textbox Name="textbox1">
<rd:DefaultName>textbox1</rd:DefaultName>
<ZIndex>3</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</Corner>
<Height>0.5in</Height>
<MatrixRows>
<MatrixRow>
<Height>0.25in</Height>
<MatrixCells>
<MatrixCell>
<ReportItems>
<Textbox Name="ProductID">
<rd:DefaultName>ProductID</rd:DefaultName>
<Style>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Count(Fields!ProductID.Value)</Value>
</Textbox>
</ReportItems>
</MatrixCell>
</MatrixCells>
</MatrixRow>
</MatrixRows>
</Matrix>
</ReportItems>
<Height>1.25in</Height>
</Body>
<rd:ReportID>ed5d6416-a54d-4c50-8568-8f5bae4484cf</rd:ReportID>
<LeftMargin>1in</LeftMargin>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
<CommandText>select * from products where ReorderLevel not IN (@.Level)</CommandText>
<QueryParameters>
<QueryParameter Name="@.Level">
<Value>=Parameters!Level.Value</Value>
</QueryParameter>
</QueryParameters>
<DataSourceName>Northwind</DataSourceName>
</Query>
<Fields>
<Field Name="ProductID">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>ProductID</DataField>
</Field>
<Field Name="ProductName">
<rd:TypeName>System.String</rd:TypeName>
<DataField>ProductName</DataField>
</Field>
<Field Name="SupplierID">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>SupplierID</DataField>
</Field>
<Field Name="CategoryID">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>CategoryID</DataField>
</Field>
<Field Name="QuantityPerUnit">
<rd:TypeName>System.String</rd:TypeName>
<DataField>QuantityPerUnit</DataField>
</Field>
<Field Name="UnitPrice">
<rd:TypeName>System.Decimal</rd:TypeName>
<DataField>UnitPrice</DataField>
</Field>
<Field Name="UnitsInStock">
<rd:TypeName>System.Int16</rd:TypeName>
<DataField>UnitsInStock</DataField>
</Field>
<Field Name="UnitsOnOrder">
<rd:TypeName>System.Int16</rd:TypeName>
<DataField>UnitsOnOrder</DataField>
</Field>
<Field Name="ReorderLevel">
<rd:TypeName>System.Int16</rd:TypeName>
<DataField>ReorderLevel</DataField>
</Field>
<Field Name="Discontinued">
<rd:TypeName>System.Boolean</rd:TypeName>
<DataField>Discontinued</DataField>
</Field>
</Fields>
</DataSet>
</DataSets>
<Width>2.5in</Width>
<InteractiveHeight>11in</InteractiveHeight>
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>

|||

In RS 2005, I have a report with 5 report parameters. Two of those parameters are query based in order to populate drop down lists in the report for the user.

The BUG occurs when the report initialises: the first query based parameter is populated but the second query-based parameter is blank. I select the available values in both parameters and click on the "View Report" button but the same BUG occurs: the first parameter is populated but the second parameter's values are reset. If I select values from both and click the View Report button a few times it will eventually display the report.

Have any of you encountered anything like this?

Niall

sql

How to show table header, footer even when the dataset is empty?

hi,

Just got a question about the report. When my report does not get any data from database, like dataset is empty, it will show nothing. This is reasonable. But what our customers want is, they still need to show the table header, footer, but no data.

Thanks.

Hi, what you desire appears to be the default behavior in RS 2005 unless NoRows is specified.

How to show table header, footer even when the dataset is empty?

hi,
Just got a question about the report. When my report does not get any
data from database, like dataset is empty, it will show nothing. This
is reasonable. But what our customers want is, they still need to show
the table header, footer, but no data.
ThanksHi Nick,
What is in the table headers and footers...dataset field values only
or possibly the header or footer has text? If you do have text in the
header or footer and they don't appear, check the NoRows property for
the table...any text or string value expression you set will cause the
table to not appear in favor of the expression you set. Text in
headers or footers does display, by default, even if a table has no
records...so you can also check for condittional logic that is hiding
the header or footer.
Maybe you can explain what your table headers and footers have in them?
If it's all dataset field vlaues-what shoud appear?
MattA
Reporting Services Newsletter at www.reportarchitex.com

How to show rows of dataset as columns in report

Hi,
I have a dataset whose rows need to shown as columns of a table in report.
Is it possible to do so?
Please help
regards,
SachinCan you use a matrix instead of a table?
"Sachin Laddha" <SachinLaddha@.discussions.microsoft.com> wrote in message
news:5E1EAF65-33C1-4D19-B230-D4826ACA3BA7@.microsoft.com...
> Hi,
> I have a dataset whose rows need to shown as columns of a table in report.
> Is it possible to do so?
> Please help
> regards,
> Sachin|||Hi,
I am quite new to reporting services.
Wll matrix solve my problem?
Please help.
regards,
Sachin.
"Steve MunLeeuw" wrote:
> Can you use a matrix instead of a table?
> "Sachin Laddha" <SachinLaddha@.discussions.microsoft.com> wrote in message
> news:5E1EAF65-33C1-4D19-B230-D4826ACA3BA7@.microsoft.com...
> > Hi,
> >
> > I have a dataset whose rows need to shown as columns of a table in report.
> > Is it possible to do so?
> >
> > Please help
> > regards,
> > Sachin
>
>|||I think that it will. The Adventure Works Sample Reports that ships with
SSRS 2005 has a Company Sales report that demonstrates the use of the
matrix. It has Order Year and Order Qtr as columns across the top.
"Sachin Laddha" <SachinLaddha@.discussions.microsoft.com> wrote in message
news:334F642D-F816-46FD-BBF4-7F8D1E0B8276@.microsoft.com...
> Hi,
> I am quite new to reporting services.
> Wll matrix solve my problem?
> Please help.
> regards,
> Sachin.
>
> "Steve MunLeeuw" wrote:
>> Can you use a matrix instead of a table?
>> "Sachin Laddha" <SachinLaddha@.discussions.microsoft.com> wrote in message
>> news:5E1EAF65-33C1-4D19-B230-D4826ACA3BA7@.microsoft.com...
>> > Hi,
>> >
>> > I have a dataset whose rows need to shown as columns of a table in
>> > report.
>> > Is it possible to do so?
>> >
>> > Please help
>> > regards,
>> > Sachin
>>sql

How to show distinct rows of the column of the dataset and number of distinct rows of that colum

suppose i have aDataset with 11 rows. field1 with 5 rows of aaa, 6 rows of "bbb"

I want's some thing like

field1 rowcount
aaa 5
bbb 6

Have a table and map it to the dataset. Insert a group (say table_Group1) to the table with the grouping column being "Fields!field1.Value". In the group header row of your table, use Fields!field1.Value and CountDistinct(FIelds!field1.Value, "table_Group1") to get your desired values.

Pls mark the post as answered if your problem is solved.

Shyam

Monday, March 26, 2012

How to show all the fields in a dataset.

I have a sp that returns a different dataset depending on the parameter
values, it is dyanamic sp which has different field names and also the
number of fields.
Is there a way to incorporate this in reporting services, like in .Net
we can display the dataset by just binding it to the datagrid and
letting datagrid handle the rest.
Thanks,
TonyNo. RS does not work that way. It expects a consistent number/name of
fields.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<bubaa118@.yahoo.com> wrote in message
news:1107965810.679249.274270@.c13g2000cwb.googlegroups.com...
> I have a sp that returns a different dataset depending on the parameter
> values, it is dyanamic sp which has different field names and also the
> number of fields.
> Is there a way to incorporate this in reporting services, like in .Net
> we can display the dataset by just binding it to the datagrid and
> letting datagrid handle the rest.
> Thanks,
> Tony
>|||Thanks for the prompt reply Bruce, Is there any other workaround for
the issue I have any ideas or suggestions would be great.
Thanks again,
Tony|||You can have multiple datasets in a report, each of them calling the
procedure with the appropriate parameter. This does mean the SP will get
called multiple times. Then you should be able to hide the table on the
report if there is no data. I haven't tried this but I think you can. You
still might end up with some blank lines though.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<bubaa118@.yahoo.com> wrote in message
news:1107967055.899883.298640@.f14g2000cwb.googlegroups.com...
> Thanks for the prompt reply Bruce, Is there any other workaround for
> the issue I have any ideas or suggestions would be great.
> Thanks again,
> Tony
>|||You could also at the end of your proc pivot (or is this really
unpivoting) the data. So for a table with structure
# keycol # col1 # col2 # col3 # col4 # ... # col<n> #
you would end up with
# keycolvalue # colname # colvalue #
this will have n rows for each row in the original table. You may want
to modify your proc to build that to begin with rather than pivot data
later.
then you could drop that into a matrix.
This would work fairly well if all variable columns are of the same
type. Otherwise you'd have to do some formatting in the stored
procedure.

How to share dataset after it was created within the report

Is there a way to share the dataset with the other reports once it was
created in once of the reports in the same project? Right now, we are
copying the same dataset from one to the others...
BrianI'm not sure if you want to pull out data from a created report, then
use that in the others.
Or, if you already have that data, and want to feed it into 5 reports?
I'm new to RS, and the only way I have used it sofar is setting up the
connections, parameters, then querying it through IIS. I myself am
wondering if I can take a Dataset (received through MSMQ), then tell a
Report 'use this data', then send it off to a printer (pdf etc).|||It looks like the solution to my problem will be to use the RS viewer
controls in VS.net 2005. Basically if it works the way I believe I can
get a dataset, then apply that to a number of reports, save them off to
PDF, then I am done.

Friday, March 23, 2012

How to setup Padding after clicking ToggleItem

I am trying to format the output result from a Recursive Group dataset.
The dataset is very simple with EmployeeID and ManagerID as recursive and
the latter being the parent id. Table structure is very simple with one
line on the detail level with EmployeeID, EmployeeName, ManagerName & Level
(using Level Function).
The report correctly returns all the records order by Level and Toggle by
EmployeeID. However, I would like to setup Padding when subsequent levels
show up after clicking the ToggleItem. Where would I set that up? Any
required scripts involved (iif...?). I would also like to setup different
color formatting for the different levels, and I assume it could be setup at
the same property setting as the Padding.
Much appreciated!
-Lawrenceyou could use Level() function to set padding and color.
For example, setting left padding to expression
=String.Format("{0}pt",Level() * 10) provides 10 points padding per level.
I would suggest using =Switch() for changing color:
=switch (Level() = 0, "Red", Level() = 1, "Blue", True, Nothing)
switch () takes a variable number of parameters in the form of (evaluation,
if true return, next evaluation ...)--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lawrence" <Lawrence@.discussions.microsoft.com> wrote in message
news:61F57876-20A5-4A81-94DB-3ABA16AD8053@.microsoft.com...
> I am trying to format the output result from a Recursive Group dataset.
> The dataset is very simple with EmployeeID and ManagerID as recursive and
> the latter being the parent id. Table structure is very simple with one
> line on the detail level with EmployeeID, EmployeeName, ManagerName &
Level
> (using Level Function).
> The report correctly returns all the records order by Level and Toggle by
> EmployeeID. However, I would like to setup Padding when subsequent levels
> show up after clicking the ToggleItem. Where would I set that up? Any
> required scripts involved (iif...?). I would also like to setup different
> color formatting for the different levels, and I assume it could be setup
at
> the same property setting as the Padding.
> Much appreciated!
> -Lawrence

Wednesday, March 21, 2012

How to setup a many-to-many schema to favor retreival speed.

I'm am novice in the RDMS world. I would like to set up a database that will scale with a large dataset of over 1,000,000 unique records. In a nutshell, I have about a million+ documents that are stored on a file server as TIFF files. Each document has 2 or more persons (names) associated with that document like "John Smith" or "Mr. John Doe" etc.. A person can be related to many documents (depending on how many transactions they conducted over the years) and any document can be related to many people as most of the transactions were from multiple sellers and multiple buyers. The end users almost always searches for documents by using the first and last name of the person related to the document along with other document fields such as DATE and TYPE to narrow the search. I would like to design and index the database for fast searching as updates are not as time sensitive. I think I need at least 3 tables:

1) NAME_TABLE normalized into NameID(PK) NameFirst, NameMiddle and NameLast

2) DOC_TABLE normalized into DocID(PK), DocTransNum, DocFilePath, DocDate, DocType, (and other attributes)

3) NAME_DOC table to relate the above two tables in a many to many relationship.

My questions are: Where should I put the field that identifies the person as a buyer or seller as it relates to the document? John Smith can be both a buyer and seller on different documents so I don't think it belongs in the NAME table. If I have a another table that splits the names into SELLER_NAMES and BUYER_NAMES it would create some duplicate names and increase the search time right? I want to search for a document using a name and the option to specify if the person name search is limited to buyers, sellers or both. Do I need to do anything special in setting up the tables for fast searching other than indexing all the name fields and the DocID field? What indexing needs to be done on the many-to-many table if any? If fast searching on a mostly static database is a top requirement, should I denormalize the document table to include the names even though there will be duplicate names throughout? How large of a test set of records do I need to load to see any real deltas in performance as I modify and tweak?

Sorry for all the questions but I believe they are related to the overall problem to solve.

Regards,

DeBug

1) Where to indicate buyer versus seller? It seems the most appropriate place is in the Name_Doc table. It is unlikely that a person is both a buyer and a seller on a given document. If they could be, then you could have two bit fields isBuyer and isSeller, both on the Name_Doc table. Queries would be straightforward with this arrangement. Do not split the Name table into buyers and sellers. You are correct that it will lead to duplication and does not model the real problem.

2) How should you index? Use the performance wizard to aid in indexing. More indexes are not necessarily better. It will have good recommendations on clustered versus non-clustered indexes.

3) Should you denormalize? No. First, it will be hard to denormalize a many-to-many relationship. Second, 1 million records seems like a large number, but in reality with today's memory and optimization engines it is not that large.

4) Dataset sizes? You will probably want 50,000 records to allow the wizard to make good suggestions. Others will have better insights than I do.

|||

Hi,

I don′t if I got you right, so I will repeat the story first to see if we are in sync. You have two entities which can be compared to books and authors. One book can written by many authors and one authors can write many books (thats the many to many RS). What you now want to do is to sell a book / documents and want to reuse the information of the first persons table, right ? So the question, why are the perons related to the documents / book ? Did they write or bought them ? Is it another realtionship than you already defined in the n-m RS ?

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

Thanks for the response. You are correct that a buyer and seller are two different people and that a single person would not sell to himself. I can not think of an execption to this unless a parent sells to his child so that "John Smith" was the seller and "John Smith" was a buyer. This could also be true in the event that two people with the same name are conducting business. Rare, but it could happen. So I guess the sofware should not care if a "Doug DeBug" sold to a "Doug DeBug" as long as the user could enter "Doug DeBug" and the business logic would return the correct document, then all is well. All index information is keyed from the actual image so this should not be a problem in that a string of characters is simply associated with a document image. So if I understand you, I could add a field to the Name_Doc table like "IsBuyer" as a TRUE or FALSE and use that logic to search for John Smith the buyer and or John Smith the seller?

I'm using SQL Express so I'm not sure it contains the performance wizard. However, I have a subscription to MS's action pack which includes a version of SQL that I'm sure will contain the wizard. I would guess that I could tune the database using that as a tool and then model the results to the Express version for production.

I will try the 50K records level and see what Mr. Wizard suggests.

Thanks again for your reply.

DeBug

|||

Jens,

Yes, the books and authors is a good example of what I'm doing. The documents would be like the books and the buyers and sellers would be like the authors. The exception is that I need to also search on a name based on if the person is a seller or a buyer. So there is some additional work there. Also, your post mentions the reuse of the information of the first person. I really don't need to do that but simply want to be able to search for the correct document using a person's name and type (was this person a buyer or seller) to correctly locate and display the right TIFF file to the user. Kind of like an electronic filing cabinet type of application. I've written many of these before using Access and Visual Basic 6 but this project is much larger. When SQL Express was introduced, I was just waiting for the right project to come along to take advantage of this wonderful (and free) tool. To answer your second question, the named persons are simple the owners and buyers and the document is a scanned copy of the sales contract. When a disputed document is need to resolve a problem between the buyer and seller, a user will ask the person making the request if they were the buyer or seller and use this to narrow down the search. Most requestors have nothing to start with other than the persons name. In fact, sometimes they don't know if the person was the buyer or seller and thus the need to be able to search for all documents related to a specific name. Hope this helps clarify the problem.

Thanks for responding to my questions.

DeBug

|||

Hi,

ok I *think* I got you :-) There can be multiple buyers and sellers based on one document. That should be something like:

CREATE TABLE Document
(
DocumentId
<additional columns here>
)

CREATE TABLE InvolvedPersons
(
PersonId
<additional columns here>
)


CREATE TABLE AssociatedPersonsToDocuments
(
DocumentId,
PersonId,
AssociationType
<additional columns here>
)

CREATE TABLE AssociationType
(
AssociationType --This can be buyer "B" or seller "S" or additional flag that you want to set in the future, e.g. author of the contract, etc.
<additional columns here>
)

The names of the columns are sure replaceable, this was just for my own understanding and to show you how this fits all together

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

I don't follow your logic with the additional tables. Here is where I'm am on the problem:

CREATE TABLE [dbo].[Names](
[NameID] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MiddleName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Suffix] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_Names] PRIMARY KEY CLUSTERED
(
[NameID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[Documents](
[DocID] [int] IDENTITY(1,1) NOT NULL,
[DocPath] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DocFileDate] [smalldatetime] NOT NULL,
CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED
(
[DocID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[NamesDocuments](
[NameDocID] [int] IDENTITY(1,1) NOT NULL,
[NameID] [int] NOT NULL,
[DocID] [int] NOT NULL,
[Type] [bit] NOT NULL,
CONSTRAINT [PK_NamesDocuments] PRIMARY KEY CLUSTERED
(
[NameDocID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[NamesDocuments] WITH CHECK ADD CONSTRAINT [FK_NamesDocuments_Documents] FOREIGN KEY([DocID])
REFERENCES [dbo].[Documents] ([DocID])
GO
ALTER TABLE [dbo].[NamesDocuments] CHECK CONSTRAINT [FK_NamesDocuments_Documents]
GO
ALTER TABLE [dbo].[NamesDocuments] WITH CHECK ADD CONSTRAINT [FK_NamesDocuments_Names] FOREIGN KEY([NameID])
REFERENCES [dbo].[Names] ([NameID])
GO
ALTER TABLE [dbo].[NamesDocuments] CHECK CONSTRAINT [FK_NamesDocuments_Names]

The above script creates the two tables for the names and documents. The many-to-many table contains the linking info with the additional column to identify if the nameIDtoDocumentID for that record was a buyer of seller for that transaction. What advantages do I have in using your example that contained an additional table to identify if the named person(s) were buyers or sellers....I'm confused :)

DeBug

|||

See my response to Jens for how I set up the tables and if that is what you would expect. Also, the NamesDocuments table will be about 3 to 3.5 times the size of the documents table so table size will be more like 3,250,000 rows and not the 1 million as I first suggested.

Again, thanks for your help on this!

DeBug

|||

OK, lets abstract my samples. As I saw from your tables you are only prepared for storing two types of people, buyers and sellers (which is stored in the Type column, right ? ) . If you only want this, then you are ok. If you want to store more information about the document like other persons which are involved in the document (like lawyers etc, mentioned in my sample you would have to extend your database) If you would store the Type as a integer (instead of a bit) you would be able to map the type to the additional table (mentioned in my sample) and extened your solution to include various type of perople involved in the document. Lets make a sample of your NamesDocuments table

[NameDocID] [NameID] [DocID] [Type]
1 1 1 1
2 2 1 2
3 3 1 3

Being Type like the following (1=buyer, 2=seller,3=lawyer), you will be able to extend this making something like 4=referals,5=reviewers etc.

That would be a great advantage to the solution with the bit option.

Hope I didn′t confused you too much :-)

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

I like your idea of extending the named persons beyond just buyer and seller. Adding another type like "reviewer" might be something I would want to add if the business rules were to change, which could happen at any time. Currently, a log is kept as the documents move through the workflow that audit the creation and review process but is not part of the long term document history. Is there a performance penality if I add another table "Types" with TypeID (PK int), Description (vchar(20))? Would this would require an additional JOIN to extract the TYPE of person and slow down performance? Or do I simply change the data type to "int", and use business logic to say that a 1 is "buyer" and that a "2" is "seller", etc. and not add an additional table? Also, I was able to set the one-to-many relationships (at least I think I set them up correctly) from the NamesDocuments table to the respective Names and Documents tables. What do I need to do to set up referential rules and or constraints to prevent orphaned records? I think I can change or correct a row from the Names table without changing any of the related records. Also true of the Documents table. However, even as a novice, I know you should not delete rows from the Names or Documents table that are part of the many-to-many table. In our business, it is common to find a document that was not correctly indexed and the administrator would need to ability to update a document to add/remove/change buyers and or sellers to correct any errors. My next task is to figure out a way to load about 25,000 random names to the Names table. I will most likely use VB.NET and some name data from the 1990 Census to simulate that table. The documents table can simply be a TIFF file used over and over again with a new file name so no problem there. Thank you for your help and suggestions!

Regards,

DeBug

How to setup a many-to-many schema to favor retreival speed.

I'm am novice in the RDMS world. I would like to set up a database that will scale with a large dataset of over 1,000,000 unique records. In a nutshell, I have about a million+ documents that are stored on a file server as TIFF files. Each document has 2 or more persons (names) associated with that document like "John Smith" or "Mr. John Doe" etc.. A person can be related to many documents (depending on how many transactions they conducted over the years) and any document can be related to many people as most of the transactions were from multiple sellers and multiple buyers. The end users almost always searches for documents by using the first and last name of the person related to the document along with other document fields such as DATE and TYPE to narrow the search. I would like to design and index the database for fast searching as updates are not as time sensitive. I think I need at least 3 tables:

1) NAME_TABLE normalized into NameID(PK) NameFirst, NameMiddle and NameLast

2) DOC_TABLE normalized into DocID(PK), DocTransNum, DocFilePath, DocDate, DocType, (and other attributes)

3) NAME_DOC table to relate the above two tables in a many to many relationship.

My questions are: Where should I put the field that identifies the person as a buyer or seller as it relates to the document? John Smith can be both a buyer and seller on different documents so I don't think it belongs in the NAME table. If I have a another table that splits the names into SELLER_NAMES and BUYER_NAMES it would create some duplicate names and increase the search time right? I want to search for a document using a name and the option to specify if the person name search is limited to buyers, sellers or both. Do I need to do anything special in setting up the tables for fast searching other than indexing all the name fields and the DocID field? What indexing needs to be done on the many-to-many table if any? If fast searching on a mostly static database is a top requirement, should I denormalize the document table to include the names even though there will be duplicate names throughout? How large of a test set of records do I need to load to see any real deltas in performance as I modify and tweak?

Sorry for all the questions but I believe they are related to the overall problem to solve.

Regards,

DeBug

1) Where to indicate buyer versus seller? It seems the most appropriate place is in the Name_Doc table. It is unlikely that a person is both a buyer and a seller on a given document. If they could be, then you could have two bit fields isBuyer and isSeller, both on the Name_Doc table. Queries would be straightforward with this arrangement. Do not split the Name table into buyers and sellers. You are correct that it will lead to duplication and does not model the real problem.

2) How should you index? Use the performance wizard to aid in indexing. More indexes are not necessarily better. It will have good recommendations on clustered versus non-clustered indexes.

3) Should you denormalize? No. First, it will be hard to denormalize a many-to-many relationship. Second, 1 million records seems like a large number, but in reality with today's memory and optimization engines it is not that large.

4) Dataset sizes? You will probably want 50,000 records to allow the wizard to make good suggestions. Others will have better insights than I do.

|||

Hi,

I don′t if I got you right, so I will repeat the story first to see if we are in sync. You have two entities which can be compared to books and authors. One book can written by many authors and one authors can write many books (thats the many to many RS). What you now want to do is to sell a book / documents and want to reuse the information of the first persons table, right ? So the question, why are the perons related to the documents / book ? Did they write or bought them ? Is it another realtionship than you already defined in the n-m RS ?

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

Thanks for the response. You are correct that a buyer and seller are two different people and that a single person would not sell to himself. I can not think of an execption to this unless a parent sells to his child so that "John Smith" was the seller and "John Smith" was a buyer. This could also be true in the event that two people with the same name are conducting business. Rare, but it could happen. So I guess the sofware should not care if a "Doug DeBug" sold to a "Doug DeBug" as long as the user could enter "Doug DeBug" and the business logic would return the correct document, then all is well. All index information is keyed from the actual image so this should not be a problem in that a string of characters is simply associated with a document image. So if I understand you, I could add a field to the Name_Doc table like "IsBuyer" as a TRUE or FALSE and use that logic to search for John Smith the buyer and or John Smith the seller?

I'm using SQL Express so I'm not sure it contains the performance wizard. However, I have a subscription to MS's action pack which includes a version of SQL that I'm sure will contain the wizard. I would guess that I could tune the database using that as a tool and then model the results to the Express version for production.

I will try the 50K records level and see what Mr. Wizard suggests.

Thanks again for your reply.

DeBug

|||

Jens,

Yes, the books and authors is a good example of what I'm doing. The documents would be like the books and the buyers and sellers would be like the authors. The exception is that I need to also search on a name based on if the person is a seller or a buyer. So there is some additional work there. Also, your post mentions the reuse of the information of the first person. I really don't need to do that but simply want to be able to search for the correct document using a person's name and type (was this person a buyer or seller) to correctly locate and display the right TIFF file to the user. Kind of like an electronic filing cabinet type of application. I've written many of these before using Access and Visual Basic 6 but this project is much larger. When SQL Express was introduced, I was just waiting for the right project to come along to take advantage of this wonderful (and free) tool. To answer your second question, the named persons are simple the owners and buyers and the document is a scanned copy of the sales contract. When a disputed document is need to resolve a problem between the buyer and seller, a user will ask the person making the request if they were the buyer or seller and use this to narrow down the search. Most requestors have nothing to start with other than the persons name. In fact, sometimes they don't know if the person was the buyer or seller and thus the need to be able to search for all documents related to a specific name. Hope this helps clarify the problem.

Thanks for responding to my questions.

DeBug

|||

Hi,

ok I *think* I got you :-) There can be multiple buyers and sellers based on one document. That should be something like:

CREATE TABLE Document
(
DocumentId
<additional columns here>
)

CREATE TABLE InvolvedPersons
(
PersonId
<additional columns here>
)


CREATE TABLE AssociatedPersonsToDocuments
(
DocumentId,
PersonId,
AssociationType
<additional columns here>
)

CREATE TABLE AssociationType
(
AssociationType --This can be buyer "B" or seller "S" or additional flag that you want to set in the future, e.g. author of the contract, etc.
<additional columns here>
)

The names of the columns are sure replaceable, this was just for my own understanding and to show you how this fits all together

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

I don't follow your logic with the additional tables. Here is where I'm am on the problem:

CREATE TABLE [dbo].[Names](
[NameID] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MiddleName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Suffix] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_Names] PRIMARY KEY CLUSTERED
(
[NameID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[Documents](
[DocID] [int] IDENTITY(1,1) NOT NULL,
[DocPath] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DocFileDate] [smalldatetime] NOT NULL,
CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED
(
[DocID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[NamesDocuments](
[NameDocID] [int] IDENTITY(1,1) NOT NULL,
[NameID] [int] NOT NULL,
[DocID] [int] NOT NULL,
[Type] [bit] NOT NULL,
CONSTRAINT [PK_NamesDocuments] PRIMARY KEY CLUSTERED
(
[NameDocID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[NamesDocuments] WITH CHECK ADD CONSTRAINT [FK_NamesDocuments_Documents] FOREIGN KEY([DocID])
REFERENCES [dbo].[Documents] ([DocID])
GO
ALTER TABLE [dbo].[NamesDocuments] CHECK CONSTRAINT [FK_NamesDocuments_Documents]
GO
ALTER TABLE [dbo].[NamesDocuments] WITH CHECK ADD CONSTRAINT [FK_NamesDocuments_Names] FOREIGN KEY([NameID])
REFERENCES [dbo].[Names] ([NameID])
GO
ALTER TABLE [dbo].[NamesDocuments] CHECK CONSTRAINT [FK_NamesDocuments_Names]

The above script creates the two tables for the names and documents. The many-to-many table contains the linking info with the additional column to identify if the nameIDtoDocumentID for that record was a buyer of seller for that transaction. What advantages do I have in using your example that contained an additional table to identify if the named person(s) were buyers or sellers....I'm confused :)

DeBug

|||

See my response to Jens for how I set up the tables and if that is what you would expect. Also, the NamesDocuments table will be about 3 to 3.5 times the size of the documents table so table size will be more like 3,250,000 rows and not the 1 million as I first suggested.

Again, thanks for your help on this!

DeBug

|||

OK, lets abstract my samples. As I saw from your tables you are only prepared for storing two types of people, buyers and sellers (which is stored in the Type column, right ? ) . If you only want this, then you are ok. If you want to store more information about the document like other persons which are involved in the document (like lawyers etc, mentioned in my sample you would have to extend your database) If you would store the Type as a integer (instead of a bit) you would be able to map the type to the additional table (mentioned in my sample) and extened your solution to include various type of perople involved in the document. Lets make a sample of your NamesDocuments table

[NameDocID] [NameID] [DocID] [Type]
1 1 1 1
2 2 1 2
3 3 1 3

Being Type like the following (1=buyer, 2=seller,3=lawyer), you will be able to extend this making something like 4=referals,5=reviewers etc.

That would be a great advantage to the solution with the bit option.

Hope I didn′t confused you too much :-)

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

I like your idea of extending the named persons beyond just buyer and seller. Adding another type like "reviewer" might be something I would want to add if the business rules were to change, which could happen at any time. Currently, a log is kept as the documents move through the workflow that audit the creation and review process but is not part of the long term document history. Is there a performance penality if I add another table "Types" with TypeID (PK int), Description (vchar(20))? Would this would require an additional JOIN to extract the TYPE of person and slow down performance? Or do I simply change the data type to "int", and use business logic to say that a 1 is "buyer" and that a "2" is "seller", etc. and not add an additional table? Also, I was able to set the one-to-many relationships (at least I think I set them up correctly) from the NamesDocuments table to the respective Names and Documents tables. What do I need to do to set up referential rules and or constraints to prevent orphaned records? I think I can change or correct a row from the Names table without changing any of the related records. Also true of the Documents table. However, even as a novice, I know you should not delete rows from the Names or Documents table that are part of the many-to-many table. In our business, it is common to find a document that was not correctly indexed and the administrator would need to ability to update a document to add/remove/change buyers and or sellers to correct any errors. My next task is to figure out a way to load about 25,000 random names to the Names table. I will most likely use VB.NET and some name data from the 1990 Census to simulate that table. The documents table can simply be a TIFF file used over and over again with a new file name so no problem there. Thank you for your help and suggestions!

Regards,

DeBug