Using Default Relationships With Dynamic SQL

Aug 21, 2006

Hi,
I have a series of dropdownlist that get populated with the all the table names in my database. Once a table is selected it brings up the fields and allows you to choose a relationship to a value (i.e. >= 9). My problem is that I need to turn this into a SQL statement to be sent my database. I've made dynamic SQL statements before, but when your on the table level it seems you need to provide the relationship between the tables yourself. This is a huge problem because some tables are related only between two other tables, so to insert the relationship would involve an insane amount of 'if' or 'select' statements and would get very messy. I've heard that in MS SQL Server 2005 they have an option where you can use the default relationship (the one stated in the database). Could someone provide me with some sample code for that? My database is on a 2003, so this option (if it does exist) isn't there. Are they any other solutions then to me builting an elaborate piece of logic to match tables?

TIA

View 1 Replies


ADVERTISEMENT

Power Pivot :: Dynamic Slicers Without Two Way Relationships?

Nov 13, 2015

So, after my last post where the issue came down to my model, I have redone my data sources as a v.2 model and split out into traditional dim/fact tables. I have 2 fact tables a few dims that are shared between the two facts and some dims that are only on one fact.

In my old model I was doing most of this de-normalisation in my sql queries to produce the fact tables (and the two fact tables were related together).

In v1 I used to get a much better context-aware set of slicers as they were directly connected to the fact that the visualisations on the page were relating to. As I selected a slicer, any other slicers items that were no longer possible would disappear.

This is no longer happening with this star-schema method. The old way was better from a user perspective. I had to remove some "both" cross filter directions from the relationship model due on the dims that were shared between both facts, so they are only now Single. I wonder if that has any bearing on this but even if it does, I don't see a solution from this angle.

I guess the only idea I have would be to create calculated measures/columns (probably columns) to materialise the interesting dim values into the fact table but this seems a bit of a time consuming process and as I don't necessarily know in advance which slicers the users may want to use, so it feels like I almost need to add all possible dimension attributes in each fact table... ?

Here is my relationship diagram. In my testing the slicer updates work ok if they are on a 2 way relationship but not on a Single way relationship.

In my case my 2 fact tables are really related (SchemeParticipantResult is a parent of ParticipantMeasureResult) but this then breaks the traditional Star schema that I was advised to follow before.

View 6 Replies View Related

UpdateParameter Dynamic Default Value Using &<% .. %&> ?

Aug 16, 2006

<asp:SqlDataSource ID="srcUser" SelectCommand="..." ConnectionString="..." UpdateCommand="Admin_resetAccountStatus" UpdateCommandType="StoredProcedure">    <UpdateParameters>        <asp:Parameter Name="SomeFormData" Type="String" />        <asp:Parameter Name="NTID" Type="String"             DefaultValue="<% =User.Identity.Name %>" />        </UpdateParameters></asp:SqlDataSource>I have this SQLDataSource defined, with some update parameters passing form data to a stored procedure.  For auditing purpose, I also need to pass current user ID, which is User.Identity.Name.  However, the DefaultValue takes <% =User.Identity.Name %> literally.How can I pass parameter value using <% ... %> WITHOUT writing any code behind page?Thanks.

View 8 Replies View Related

Dynamic Default Value For Parameter In OLAP Report

Apr 16, 2007

I'm trying to set up a parameter report from a OLAP cube. I need 3 dynamic parameters(ThisYear, ThisMonth, YESTERDAY).



THISYEAR: =CStr(DatePart("yyyy",Today()))

THISWEEK: =CSTR(DATEPART("ww",Today()))

YESTERDAY: =CSTR(Datepart("d", Today().AddDays(-1)))



So far so good. I want to send this report by email everyday, so I need to set these parameters as a default value. This is where I run into problems.

When I add any of these parameters I get the following error "The restrictions by the CONSTRAINED flag in the STRTOSET function were violated". This problem occur when I choose NON-queried under Report->Report Parameters, and set a default value for THISYEAR under DEFAULT VALUES

=CStr(DatePart("yyyy",Today()))



Hope someone found a way around this problem.



Thanks in advance!

View 2 Replies View Related

Dynamic Default Value For Parameter In OLAP Report

Feb 28, 2007

I have a basic SSRS report against an SSAS database with a "start date" parameter. I want to set the default value of that date parameter to Today's date. What is the easiest way to do this? I have no problem doing it against a relational source, just haven't done it against an OLAP source.

Thanks for any ideas.

-Josh R.

View 1 Replies View Related

Analysis :: Dynamic Default Values For Parameter

Nov 11, 2015

I am trying to write a query for the default values for month, and I am stuck in bringing out only the parameter values, the query I have , brings back the month on row and value on column, and I am trying to get the value out. and will ssrs accept it as a valid expression for a default value

WITH 
MEMBER
[MEASURES].[PARAMETERVALUE]
AS
[Account].[Month Short Name].CURRENTMEMBER.UNIQUENAME

[Code] .....

I tried using the exp

=Parameters!MONTH.Value(0)

so as to return the first parameter in the parameter dataset , but i have the error the expression that ref the parameter MONTH does not exists in the parameter collection.

View 2 Replies View Related

SQL Server 2012 :: Use Of Default Keyword As Parameter Default - What Value Is It

Aug 11, 2015

@pvColumnName  VARCHAR(100) = Default,  

However, I am unable to determine what is the value for Default. Is it '' ?

Default is not permitted as a constant - below fails to parse:

WHERE t2.TABLE_TYPE = 'BASE TABLE'
AND (@pvColumnName = Default OR t1.[COLUMN_NAME] Like @vColumnName)

View 4 Replies View Related

Importing Excel Sheet Which Have Dynamic Column Name And Dynamic Number Of Columns

Aug 25, 2007

Hi Craig/Kamal,

I got your email address from your web cast. I really enjoyed the web cast and found it to be
very informative.

Our company is planning to use SSIS (VS 2005 / SQL Server 2005). I have a quick question
regarding the product. I have looked for the information on the web, but was not able to find
relevant information.

We are getting Source data from two of our client in the form of Excel Sheet. These Excel sheets
Are generated using reporting services. On examining the excel sheet, I found out that the name
Of the columns contain data itself, so the names are not static such as Jan 2007 Sales, Feb 2007 Sales etc etc.
And even the number of columns are not static. It depends upon the range of date selected by the user.

I wanted to know, if there is a way to import Excel sheet using Integration Services by defining the position
Of column, instead of column name and I am not sure if there is a way for me to import excel with dynamic
Number of columns.

Your help in this respect is highly appreciated!

Thanks,


Hi Anthony, I am glad the Web cast was helpful.

Kamal and I have both moved on to other teams in MSFT and I am a little rusty in that area, though in general dynamic numbers of columns in any format is always tricky. I am just assuming its not feasible for you to try and get the source for SSIS a little closer to home, e.g. rather than using Excel output from Reporting Services, use the same/some form of the query/data source that RS is using.

I suggest you post a question on the SSIS forum on MSDN and you should get some good answers.
http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1
http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1

Thanks



Craig Guyer
SQL Server Reporting Services

View 12 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

SSRS 2005 - Email Report On Execution To Dynamic List With Dynamic Parameters = No Schedule

Nov 23, 2007

Hi,
I have a need to display on screen AND email a pdf report to email addresses specified at run time, executing the report with a parameter specified by the user. I have looked into data driven subscriptions, but it seems this is based on scheduling. Unfortunately for the majority of the project I will only have access to SQL 2005 Standard Edition (Production system is Enterprise), so I cannot investigate thoroughly.

So, is this possible using data driven subscriptions? Scenario is:

1. User enters parameter used for query, as well as email addresses.
2. Report is generated and displayed on screen.
3. Report is emailed to addresses specified by user.

Any tips on how to get this working?

Thanks

Mark Smith

View 3 Replies View Related

Merge Replication W/ Dynamic Row Filter - Not 'dynamic' After First Initial Sync?

May 2, 2007

If anyone could confirm...

SQL Server 2000 SP4 to multiple SQL Server 2005 Mobile Edition on PDAs. My DB on SQL2k is published with a single dynamic row filter using host_name() on my 'parent' table and also join filters from parent to child tables. The row filter uses joins to other tables elsewhere that are not published to evaluate what data is allowed through the filter.

E.g. Published parent table that contains suppliers names, etc. while child table is suppliers' products. The filter queries host_name(s) linked to suppliers in unpublished table elsewhere.

First initial sync with snapshot is correct and as I expected - PDA receives only the data from parent (and thus child tables) that matches the row filter for the host_name provided.

However - in my scenario host_name <--> suppliers may later be updated E.g. more suppliers assigned to a PDA for use or vice versa. But when I merge the mobile DB, the new data is not downloaded? Tried re-running snapshot, etc., no change.

Question: I thought the filters would remain dynamic and be applied on each sync?

I run a 'harmless' update on parent table using TSQL e.g. "update table set 'X' = 'X'" and re-sync. Now the new parent records are downloaded - but the child records are not!

Question: I wonder why if parent records are supplied, why not child records?

If I delete existing DB and sync new, I get the updated snapshot and all is well - until more data added back at server...

Any help would be greatly appreciated. Is it possible (or not) to have dynamic filters run during second or subsequent merge?

View 4 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







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