How To De-normalize One To Many Relationships?

May 8, 2007

I am a newbie to SSIS. I have been working through SQL Server 2005 Integration Services and am quite pleased with the book and with SSIS. That said, I am having trouble determining how to handle a challenge.



The business challenge is that we need to push new inventory items that we sell from our back end accounting system onto our web site. The challenge is that each item can show up in 1 or 100 categories. The silly web software wants us to write the item and the categories that item is associated with in one transaction / command.



Stated another way, when we push an item into the web store, we need to push the item and an array of categories in the same transaction.



This is my technical challenge, I cannot figure out how to select 100 records out of an item table in MS-SQL and then create an array of categories for each of those 100 items. (items belong to >1 categories)



I thought I could use two OLE DB sources where the main source was the item table and the 2nd source was the category table.



My best guess at this point is to use an OLE DB source for the item table. Then use the script component and hard code the read from the category list within the script component.



As a note, scalability is not really an issue, there would be no more than 10-20 items being pushed at any given time.



Any help would be GREATLY appriciated.

View 5 Replies


ADVERTISEMENT

How To Normalize These Relationships?

Mar 4, 2007

I have three tables with a relationship I've never worked withbefore. Can anyone suggest/comment on the best way to create a thirdnormal form relationship between these tables?The tables basically are:TRAIN (TRAIN_ID and 15 columns about train specs, etc)TRUCK (TRUCK_ID and 12 columns about truck specs, etc)TRANSPORTATION_ITEMThis table has, among others, two columns, TRUCK_ID and TRAIN_ID. Ifthe truck column is used there can be no data in the train column andvice versa.This relationship seems denormalized to me, but I don't remember howto normalize it. Does anyone know the correct name for this kind ofrelationship?thanks!

View 8 Replies View Related

Need Help On SP To Normalize Data

Feb 18, 2005

We have a stored proc that runs nightly and takes 90 minutes to run.
The record count in the source table is about 630,000 rows, and the destination table ends up with 765,000 rows.

It basically normalizes data from one table into another. Because we can't track date changes in the source table, we have to repopulate the 2nd table nightly.

One record of source data looks like this:
(table A)
Song_ID Terr Catalog Percent Fix Admin
1204 1 GC62755GC61378 500000500000 ABCD|EABCD|E P10336|P1314P10336|P1314

The normalized data (4 records) looks like this:
(table B)
Song Catalog Admin Fix Terr Percent
1204 GC61378 P10336 ABCD 1 500000
1204 GC61378 P1314 E 1 500000
1204 GC62755 P10336 ABCD 1 500000
1204 GC62755 P1314 E 1 500000

Is there a way that jumps out to parse this "multi-valued" data easier than using a bunch of string functions on each record (eg. charindex, substring,len)?

View 4 Replies View Related

Normalize Data

Oct 6, 2006


Hi,
I have a table like this:






Pk_QuestionID

Question

Choice1

Choice2

Choice3

Choice4

correctChoice


1

XYZ?

a

b

C

d

3

This has to be transferred to a more normalized schema like this







Pk_QuestionID

Question


1

XYZ?

And







Pk_OptionID

Fk_QuestionID

Choice_Description

isCorrect


1

1

a

0


2

1

b

0


3

1

c

1


4

1

d

0


We can use either the unpivot-merge or a SQL Union ALL statement to achieve most of this requirement. I am unable to figure out how to transfer the €˜correctChoice€™ column. Is there a way to achieve this?

Thanks

View 8 Replies View Related

Normalize Your Database: NOT OPTIONAL!

Feb 28, 2004

I've been away for a while but now that I'm back one if the first things I noticed is how many of the problems on this forum could have been easily avoided by simply normalizing the database in question.

For those of you without formal SQL training, know this: You have to normalize your database. This is part of the process of database development. You can not just whack together a few tables in whatever way is the easiest for the problem at hand, because eventually your requirements will expand and then you need your data to be flexible.

Seriously, in the last 3 weeks I've seen many many questions where it is obvious that the problem is a flawed DB design, but all the so-called SQL gurus here will just answer the question without addressing the fact that the problem lies much deeper.

Here's a link I found on Google:
http://www.cse.unsw.edu.au/~cs3710/PMmaterials/Tutorials/normalise.htm

View 8 Replies View Related

Normalize A Table With 3 Similar Columns (was Plz Help Out)

Oct 30, 2006

Hi,I am working on SQL Server.
I have a table with columns that need to be broken down. I nees to break this table:

TelNo1 TelNo2 TelNo3

555-44-33 555-43-88 555-46-89

into:


Tel_Number

555-44-33
555-43-88
555-46-89

I tried using the union statement but i just did'nt succed. Can anyone help me,please

View 1 Replies View Related

New To SSIS, Where To Research How To Normalize And Re-key Tables And Lookups?

Oct 13, 2006

I am just getting started studying SSIS with Kirk Haselden's "Integration Services" book. The problem I am trying to solve would seem easy enough to solve in code, but I am still early in the book and would like to be able to focus on the aspects of SSIS that would help me expedite this with SSIS, or to find out early whether what I need to do cannot be easily done.

The problem itself is simple enough: I have a database of roughly 100 tables. Ignoring the poor normalization in the database for the moment, my more pressing problem is that that I need to rekey all of the main OLTP tables from a mashup of different key schemes to UNIQUEIDENTIFIERS. For example, Client table is presenrly keyed on an INT, Client Number. ClientFile table is keyed as FileType = NVARCHAR(2), ClientNumber INT, FileNumber INT (incrementing, meaningless number). Child tables to ClientFile are the same key structure as ClientFile, plus yet another (incrementing, meaningless number) INT, etc like this. I would like to know if and how or where I should be looking to convert the Client table to a UNIQUEIDENTIFIER key, and the same for the ClientFile, makes its key also a GUID, and have a reference to the new Client tables GUID key as a foreign key in the ClientFile table, and on and on like that. The Client is at the top of the food chain.

In essence, I would like to have every table's key be called ID and be a UNIQUEIDENTIFIER (GuidRow), and I would like for example, the ClientFile table to reference the Client table with a column named ClientID. I would like ClientFile's children to have a foreign key called ClientFileID, and their own keys to be ID (RowGuid).

There are also several lookups in each table where, of course, the actual string values were stored instead of a key to the value (i.e. full state or country name instead of a code from a state or country lookup table) that I need to convert to something more sensible, like replacing the state name with a state code and a country name with a country code and link to appropriate respective tables. :) In fact, some of the values I need to break out from columns could also be keyed with RowGuids as well and I would much prefer to use those than string or INT keys.

Other than those problems, most of the rest of the data in those tables could essentially ba a straight copy operation since the source database is SQL Server 2000 and moving to SQL 2005 (one notable exception is that I am converting ntext columns to nvarchar(MAX) columns.

I am assuming this is probably ridiculously simple and I just haven't found my way there yet, but I still have much of this book and the help files to go through and the Index didn't give me any comfort that this was something I will or will not be able to do easily.

The real help I am looking for is two fold: a) somebody tell me to stop reading this 700 page (very well written) tome if I would be better off writing this all in code myself, and b) if this is something that most of you could do with SSIS with both hands tied behind your back, please at least help me focus on the important transforms and tools so that I don't smend a month becoming a data warehouse wizard and ultimately not solve the problem I am most concerned with.

Please be mecriful with the heat, I have already confessed that I am new to this and am scrambling to come up to speed as fast as I can, but am beginning to think this problem is either to trivial for coverage in this book, or perhaps just not what SSIS was designed to do.

Thanks much in advance for any guidance.

View 10 Replies View Related

SQL Server 2012 :: Normalize Values From Column Split Using Tally Table?

Apr 23, 2014

I have a table that has the following structure:

EntryID int,
Categories varchar(200)

values look like:

541,'A,B,C'
345,'B,C'
234,'A,C'
657,'D,E'
435,'D'

what I want to do is extract the Categories column to a normalized separate table:

541,'A'
541,'B'
541,'C'
345,'B' ....

I found the split using the tally table useful to split one-by-one, but how can it be applied when you are referring to a table?

View 2 Replies View Related

One To One Relationships

May 29, 2007

 Ok, so I open up a book on beginning sql and it discusses relationships.There is something that appears wrong. I am not understanding how the book is describing the one to one relationship. In it's figure, it shows that the same agency can have two different artist id's. But according to it's definition of one to one list can be related from both tables.Can someone explain this further please?Thanks in advance.

View 3 Replies View Related

ADO.NET - Many-To-Many Relationships

Aug 8, 2007

How do you show many to many relationships in ASP.NET with datasources?
 I can retrieve the information from the database easily but I can't manage to save that information into a variable so that i can then call for only information in the M2M table related to the ID Key I want.  For example..1 <asp:Label ID="lblTestLabel" Text='<%# DataBinder.Eval(Container.DataItem, "title_id") %>' Runat="server" />
2
3 <script language="VB" runat="server">
4 sub Page_Load(sender as Object, e as EventArgs)
5 Dim lblTitleID As Label = Repeater1.FindControl("lblTestLabel")
6 Response.Write(lblTitleID.text)
7 End Sub
8 </script>

 When I try to run this script it dosn't work and I get the error:
 System.NullReferenceException: Object reference not set to an instance of an object.
For line 6 of the code above.  Is there a way to just retrieve information from a datasource without storing information into a label first?
PS: I use sqldatasource tags to retrieve information like:1 <asp:SqlDataSource ID="DataSet1" runat="server"
2 ConnectionString="Driver={MySQL ODBC 3.51 Driver};server=localhost;database=;user=;pwd=;option=3;"
3 ProviderName="System.Data.Odbc"
4 SelectCommand="Select * from titles order by title_id">
5 </asp:SqlDataSource>
 

View 2 Replies View Related

Many To Many && Other Relationships

Aug 10, 2007

Can someone help me sort something out. Suppose we have two tables in a database.One is named Person, and one is named Birthday. Is this a many to many relationshipor a 1 to many relationship?
Person has many birthdays. Example. Joe Schmoe has a birthday for every year of his life. birthday(7/11/1976) has many People (Many people have a birthday on 7/11/1976.

View 6 Replies View Related

Relationships...

Feb 2, 2004

Is there any easy way of getting all the relationships for the tables in aSQL server db? I've looked through Google and the Books online but I'm barely scratching the surface on the systables. I know I can go to each individual table and get the dependencies or even print out the diagram through Enterprise Manager but I really don't want to have to type out all the primary/foreign keys for 100+ tables. Any help on getting this data either through a 3rd party software or querying the systables would be great.

THT
DMW

View 5 Replies View Related

One-to-one Relationships

Mar 21, 2001

We have a table with approximately 150 colums and 2/3 of them are bit datatypes. We do not expect much activity on this table. Does it make sense to separate it into a few tables instead of 1 with one-to-one relationships? Will the join(s) significantly slow down our web application? Thank you

View 2 Replies View Related

Are Relationships Necessary

Aug 6, 2004

My hosting servers have "myLittleAdmin" installed. I am new to ms sql I have some experience with Access but I have never set up Relationships inside the database server. I have always just relied on my application logic to call the relations. What is the benefit to setting up relationships in sql, if any?

View 4 Replies View Related

One To Many Relationships

Nov 11, 2004

Is there a tool in Enterprise manager to list out the one to many & many relationships with a database?????:?:

View 4 Replies View Related

Relationships

Feb 1, 2007

Hey, I have SQL Sever Enterpise Manager. I am new at this company and I need to know the relationships between ALL the tables. Is there anywhere I can go to view all the primary keys and the relationships?

View 3 Replies View Related

Key Relationships

Jun 1, 2007

I am viewing tables in the ‘object explorer’- I can see the tables. If I open it up I can see columns, keys, constraints etc…

So I can see they key… can I tell which table/field the foreign key is connected to?

thanks

View 10 Replies View Related

Many To Many Relationships

Oct 17, 2007

Hello,

I have 3 tables. Posts, PostsTags and Tags.
This is a many to many relationship.

So PostsTags has the following columns:
PostId (PK) and TagId (PK)

I always did that way in SQL 2005.

In some examples I see PostsTags have 3 columns:
PostTagId(PK), PostId (FK), TagId (FK)

Should I use it this way, instead?

Thanks,
Miguel

View 8 Replies View Related

Relationships

Jul 13, 2006

Is it possible to have 2 different databases and create relationships inbetween the two? I am thinking about way down the road and the size of the databases and I believe that I need to split my data into multiple databases to keep from running into the size limitations.

Davids Learning

View 1 Replies View Related

One To One Relationships

May 29, 2007

Ok, so I open up a book on beginning sql and it discusses relationships.
There is something that appears wrong. I am not understanding how the book is describing the one to one relationship. In it's figure, it shows that the same agency can have two different artist id's. But according to it's definition of one to one list can be related from both tables.

http://foo.gearsector.com/foo/instr_scrns/oneToMany.gif


Can someone explain this further please?

Thanks in advance.

View 5 Replies View Related

RelationShips In SQL

Apr 1, 2008



How can I use with relationShips in SQl?
Tamir BLoch .

View 1 Replies View Related

Relationships Vs. No Relationships

Apr 3, 2007

Hello!



I have a really small database in terms of number of objects, but very big in terms of data (possibly millions of records). I always try to design my databases to be in the 3rd normal form (at least I hope they are!), but sometimes (for databases consisting of just a few tables) maintaining M:N relationships looks like an over-bloated approach to me... Let's see an actual example. I have a table like this:






Code SnippetCreate table [Airfares]
(
[OriginCity] Char(3) NOT NULL,
[DestCity] Char(3) NOT NULL,
[FareDate] Datetime Default getdate() NOT NULL,
[Price] Decimal(9,2) Default 0 NOT NULL,
[PriceChange] Decimal(9,2) Default 0 NOT NULL,
[Wrong] Bit Default 0 NOT NULL,
Primary Key ([OriginCity],[DestCity],[FareDate])
)
go







Now, at first there also was an Airline nvarchar(50) field, which stored the airline name. But now the client requested to store fares for a few airlines if it's the same price and city pair. This way we can have 3 airlines offering the same price on the same itinerary for example. So I added a dictionary table called Airlines:






Code SnippetCreate table [Airlines]
(
[AirlineCode] Char(2) NOT NULL,
[Name] Nvarchar(50) NOT NULL,
Primary Key ([AirlineCode])
)
go







Now, there are two things I can do. We are obviously dealing with the M:N relationship type here. I can either add another nvarchar column in the first table, like Airlines nvarchar(255) and store something like 'AA,AB,AC' there - those would be airline codes. OR I could do it the proper way and create a cross-reference table which will connect both Airfares and Airlines tables (this will store as many records as there are airlines for that particular itinerary, offerring the same price):






Code SnippetCreate table [AirfareAirlines]
(
[AirlineCode] Char(2) NOT NULL,
[OriginCity] Char(3) NOT NULL,
[DestCity] Char(3) NOT NULL,
[FareDate] Datetime Default getdate() NOT NULL,
Primary Key ([AirlineCode],[OriginCity],[DestCity],[FareDate])
)
go







But this is starting to look overly complicated, isn't it? The pros of this are I'm going to get real relationships, referential integrity, etc., but cons are more difficult code to query all this. What would you do? Do we really need referential integrity everywhere? Are there times when we're better not using relationships? I have seen many programmers skip referential integrity before, which always made me think they are missing something important in a Relational Database Management System.

View 13 Replies View Related

Relationships In SQL 2005?

Feb 13, 2008

Hi
How I can get to see the relationships, like in access, in sql 2005?
Thank,
K

View 1 Replies View Related

An Easy One: The Need For Relationships?

Mar 16, 2008

 Ok - I am still a bit weak on SQL.  My understanding of FK relationships in a database are to reinforce the data integrity - Correct?  For example, does it make sure that the id given for SiteID does indeed exists.  Can it link tables like JOIN in select statements? If not, is there any gains by creating them, such as performance?

View 1 Replies View Related

I've Never Been Good With Relationships

Feb 15, 2004

I'm having some trouble working out how to query some data. Rather than explain up front, here's some examples of what I want to achieve:

*******************************************************

I've got a structure which looks vaguely like this:

[ANCESTORS]

Grandparent
Parent
Child

If limit by grandparents, then I only get the lineage for that particular grandparent. I.e.:


SELECT *
FROM [ANCESTORS]
( some sort of joins here )
Where Grandparent.Name = 'Cybill'



This would return all of the children of 'Cybill' and their children. Now, if I use the following query:


SELECT *
FROM [ANCESTORS]
( some sort of joins here )
Where Child.Name = 'Jean'



This would return Jean's parents + the parents of Jean's parents (Jean's grandparents).

Likewise, if I enter:


SELECT *
FROM [ANCESTORS]
( some sort of joins here )
Where Parent.Name = 'Ron'



Then I would get Ron's parents and also his children.


*******************************************************

So, as you can see, at first it appears that I'm after a LEFT JOIN - meaning that the grandparents don't need to have child records to be returned, but, then it turns out that I need INNER JOINS - to limit grandparents when I choose children.

Can anybody see my dilemma here?

Mark-up ASP.net posts here
MarkItUp.com

View 10 Replies View Related

Relationships In MSDE - How Do I Do It?

Nov 27, 2005

Hi
I am using the Web Matrix Project to write a .NET
application.   I have set up a database using MSDE which I
accessed through the Web Matrix Project to start with.  I have now
found the Web Data Administrator which I use to backup my database and
help to transfer it to the Server where I hope to run this application
(if I ever get it finished!).

I need to set up some relationships between database tables but cannot
see a way to do this.  SQL Server Books on Line referes to
Enterprise Manager which I believe ships with the full MS SQL Server
package (and costs a package).  I am doing this on a
shoe-string.  Any ideas on how to do it?

Thanks in advance.

Mike

View 2 Replies View Related

Same Old Question About Relationships

Sep 11, 2003

I wanted to know that whether using relatioships betwenn tables improves performace for select queries?

what is the significance of using joins in queries after implementing relationships?

thanks

View 4 Replies View Related

Database Relationships

Aug 22, 2006

While playing about with SQL Server 2005 I am sure that I saw a tool to do relationships the same was as in access - however now I can't find it.

Am I seeeing things or does this really exist?

View 2 Replies View Related

Finding Relationships

Sep 23, 2005

Hi, sorry if this comes across as a stupid question, but i'm new to SQL. I have had a look on Google and on these forums but not found the answer..
I am running MS SQL 7 with a database containing around 130 tables.. i want to know if there is a query/command that i can type that will look through all the tables and tell me which ones reference a specified table (through it's key). Hope this makes sense! i've looked at some of the stored procedures but not found any that give me anything useful.

EDIT: Just so you are aware, i did not create this database, hence why i am not aware of the relationships myself, i have only just started working on it.

Thanks
Steve

View 2 Replies View Related

Relationships And Index's

Dec 14, 2006

I'm upgrading my sites forum to a newer version. I've tried, unsuccessfully so far, to transfer member details, threads and posts to the new format. I say unsuccessfully but I have made it work once by deleting the Index's and Relationships on tables and re-entering them after transfer but his ended up screwing with the regestration of new members.
Before I become more frustrated than I already am, could I run something by you guys with the experience you have.

If I delete the Rels and Indx's again, then move all my tables over and then run this code through my browser, will the Indexs and Relationships find their way back to the right place?

Part 1


Code:

strSQL = "CREATE INDEX [Ban_ID] ON [" & strDBO & "].[" & strDbTable & "BanList]([Ban_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE UNIQUE INDEX [Cat_ID] ON [" & strDBO & "].[" & strDbTable & "Category]([Cat_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Group_ID] ON [" & strDBO & "].[" & strDbTable & "Group]([Group_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Poll_ID] ON [" & strDBO & "].[" & strDbTable & "Poll]([Poll_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Author_ID] ON [" & strDBO & "].[" & strDbTable & "Author]([Author_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Group_ID] ON [" & strDBO & "].[" & strDbTable & "Author]([Group_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)


strSQL = "CREATE INDEX [" & strDbTable & "Group" & strDbTable & "Author] ON [" & strDBO & "].[" & strDbTable & "Author]([Group_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE UNIQUE INDEX [User_code] ON [" & strDBO & "].[" & strDbTable & "Author]([User_code]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE UNIQUE INDEX [Username] ON [" & strDBO & "].[" & strDbTable & "Author]([Username]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Cat_ID] ON [" & strDBO & "].[" & strDbTable & "Forum]([Cat_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Sub_ID] ON [" & strDBO & "].[" & strDbTable & "Forum]([Sub_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Last_post_author_ID] ON [" & strDBO & "].[" & strDbTable & "Forum]([Last_post_author_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)


strSQL = "CREATE INDEX [" & strDbTable & "Categories" & strDbTable & "Forum] ON [" & strDBO & "].[" & strDbTable & "Forum]([Cat_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Choice_ID] ON [" & strDBO & "].[" & strDbTable & "PollChoice]([Choice_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Poll_ID] ON [" & strDBO & "].[" & strDbTable & "PollChoice]([Poll_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Polls" & strDbTable & "PollChoice] ON [" & strDBO & "].[" & strDbTable & "PollChoice]([Poll_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Address_ID] ON [" & strDBO & "].[" & strDbTable & "BuddyList]([Address_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Author_ID] ON [" & strDBO & "].[" & strDbTable & "BuddyList]([Buddy_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Buddy_ID] ON [" & strDBO & "].[" & strDbTable & "BuddyList]([Author_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Author" & strDbTable & "BuddyList] ON [" & strDBO & "].[" & strDbTable & "BuddyList]([Buddy_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Author_ID] ON [" & strDBO & "].[" & strDbTable & "EmailNotify]([Author_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Forum_ID] ON [" & strDBO & "].[" & strDbTable & "EmailNotify]([Forum_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Author" & strDbTable & "TopicWatch] ON [" & strDBO & "].[" & strDbTable & "EmailNotify]([Author_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Toipc_ID] ON [" & strDBO & "].[" & strDbTable & "EmailNotify]([Topic_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Watch_ID] ON [" & strDBO & "].[" & strDbTable & "EmailNotify]([Watch_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Auhor_ID] ON [" & strDBO & "].[" & strDbTable & "PMMessage]([Author_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [From_ID] ON [" & strDBO & "].[" & strDbTable & "PMMessage]([From_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Message_ID] ON [" & strDBO & "].[" & strDbTable & "PMMessage]([PM_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Author" & strDbTable & "PMMessage] ON [" & strDBO & "].[" & strDbTable & "PMMessage]([From_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Forum_ID] ON [" & strDBO & "].[" & strDbTable & "Permissions]([Forum_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Forum" & strDbTable & "Permissions] ON [" & strDBO & "].[" & strDbTable & "Permissions]([Forum_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Group_ID] ON [" & strDBO & "].[" & strDbTable & "Permissions]([Group_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Forum_ID] ON [" & strDBO & "].[" & strDbTable & "Topic]([Forum_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Poll_ID] ON [" & strDBO & "].[" & strDbTable & "Topic]([Poll_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Start_Thread_ID] ON [" & strDBO & "].[" & strDbTable & "Topic]([Start_Thread_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Last_Thread_ID] ON [" & strDBO & "].[" & strDbTable & "Topic]([Last_Thread_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Moved_ID] ON [" & strDBO & "].[" & strDbTable & "Topic]([Moved_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Forum" & strDbTable & "Topic] ON [" & strDBO & "].[" & strDbTable & "Topic]([Forum_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Topic_ID] ON [" & strDBO & "].[" & strDbTable & "Topic]([Topic_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Message_date] ON [" & strDBO & "].[" & strDbTable & "Thread]([Message_date]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Message_ID] ON [" & strDBO & "].[" & strDbTable & "Thread]([Thread_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Author" & strDbTable & "Thread] ON [" & strDBO & "].[" & strDbTable & "Thread]([Author_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Topic" & strDbTable & "Thread] ON [" & strDBO & "].[" & strDbTable & "Thread]([Topic_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Topic_ID] ON [" & strDBO & "].[" & strDbTable & "Thread]([Topic_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Guest_ID] ON [" & strDBO & "].[" & strDbTable & "GuestName]([Guest_ID]) ON [PRIMARY] "

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [" & strDbTable & "Thread" & strDbTable & "GuestName] ON [" & strDBO & "].[" & strDbTable & "GuestName]([Thread_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE INDEX [Thread_ID] ON [" & strDBO & "].[" & strDbTable & "GuestName]([Thread_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

strSQL = "CREATE UNIQUE INDEX [Session_ID] ON [" & strDBO & "].[" & strDbTable & "Session]([Session_ID]) ON [PRIMARY]"

'Write to the database
adoCon.Execute(strSQL)

'If an error has occured write an error to the page
If Err.Number <> 0 Then
Response.Write("<br />Error Creating one or more Indexs <br />" & Err.description & "<br /><br />")

'Reset error object
Err.Number = 0

'Set the error boolean to True
blnErrorOccured = True
End If

View 1 Replies View Related

Supertype Relationships

Dec 14, 2004

Is there a way to create a supertype/subtype table in sql server 2000 or is supertype/subtype an abstract idea rather than an option on creating a table?

i would like to set up a supertype table:

person
personid
firstname
lastname

and two subtype tables:

employee
id
personId
ss#

customer
id
personId
someOtherInfo

how do i set this up so that I cant have the same personid in employee and customer. How do i make sure that the personid is in either one or the other.

thanks

View 1 Replies View Related

A Question About Db Relationships

Jun 5, 2006

I am starting a new project and somebody told me at work that if I create relationships (foreign keys) between my tables, it makes the database slower, the best way is to "link" the tables using sql instructions like inner/outer join.
Is that true?

Thanks in advance,
venusgirl

View 10 Replies View Related

How To Remove 1:1 Relationships

Sep 12, 2007

I have an asset schema problem which I'm not too sure how to resolve....

I have an asset table which stores values common to all asset types. I have created seperate asset type tables(VehicleAssetDetail, PropertyAssetDetail, InvestmentAssetDetail) to store their specific details.

This in turn creates 1:1 relationships between "Asset" table and the respective detail tables.

If I were to store all the details in the "Asset" table it would cause a lot of redundancy bearing in my mind there are about four other asset type details I have excluded from the schema.

Are the 1:1 relationships bad? If they are, how do I resolve them without throwing all the columns from the asset details tables into the Asset table?

Attached is a 15Kb gif image of the schema. I'd really appreciate any help with this... :)
Thanks.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved