Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Thursday, March 29, 2012

Determine table constraints for database upgrade/migration project

I have a project to update one of our program's database from one version to
another. Additionally, I will be migrating the data from one database to
another.
Here's an example:
mydb7.1
mydb8.0
Both databases exist in the same database server.
So mydb7.1 contains production data for an Online store. I need to migrate
this data in to the mydb8.0 database. The mydb8.0 database uses a newer
schema, so there will some work to convert the data to the newer layout.
Here's my problem mydb7.1 database contains hundeds of tables and foreign
key relationships. Is there some way or tool, that can help me determine
the table migration order? That way my code know's which tables to migrat
e
first, and still preserving the ref integrity.
Will it be easier to create the mydb8.0 database, just with tables, and then
migrate the data. After the data is migrated, then setup the foreign key
relations. That way, I will not need order the tables for migration? Jus
t
a thought.
ThanksRichard,
Just a thought...script out the table definitions...alter them...run and
create the tables in the new DB...transfer the data over...views or
dts...script out the PK and FK constraints then apply to the new tables in
the new DB.
HTH
Jerry
"Richard" <Richard@.discussions.microsoft.com> wrote in message
news:69ACA9B4-CB56-417B-8015-B3A168F82F36@.microsoft.com...
>I have a project to update one of our program's database from one version
>to
> another. Additionally, I will be migrating the data from one database to
> another.
> Here's an example:
> mydb7.1
> mydb8.0
> Both databases exist in the same database server.
> So mydb7.1 contains production data for an Online store. I need to
> migrate
> this data in to the mydb8.0 database. The mydb8.0 database uses a newer
> schema, so there will some work to convert the data to the newer layout.
> Here's my problem mydb7.1 database contains hundeds of tables and foreign
> key relationships. Is there some way or tool, that can help me determine
> the table migration order? That way my code know's which tables to
> migrate
> first, and still preserving the ref integrity.
> Will it be easier to create the mydb8.0 database, just with tables, and
> then
> migrate the data. After the data is migrated, then setup the foreign
> key
> relations. That way, I will not need order the tables for migration?
> Just
> a thought.
> Thanks

Monday, March 19, 2012

Details section does not show all details

I have a data entry application where the user is allowed to enter multiple funding, goals and objective selections for each Project ID record. I have a database that lists each Project by ID and a relational table for each selection and its corresponding project id. For example:

projid type descr

1 Funding Capital

1 Goal PI-1 To develop a project that will come in on schedule

1 Objective PI-1.1 Schedule objective 1

1 Goal T-3 To develop a project that will come in on budget

1 Objective T-3.1 Budget objective 1

1 Objective T-3.2 Budget objective 2

1 Objective T-3.2 Budget objective 3

The report only prints the following in the details section:

projid type descr

1 Funding Capital

1 Goal PI-1 To develop a project that will come in on schedule

1 Objective PI-1.1 Schedule objective 1

Any help is greatly appreciated!

I started a brand new report starting with the details and then adding the two groups and now all records and data shows and sort correctly.

|||

I started a new report and now all related data is showing in the details for each record. But there is another problem...the report sorts by Project Owner then Project Name. If the project name is the same in 2 different records (i.e. Record id = 89 with project name = "Project" and Record id=90 and project name = "Project" the report show record 89 but in the details it shows related detail for record id's 89 and 90 and then doesn't show the individual record id = 90 at all. I don't understand why the details for each record are dependent on the project name. I am new to SQL Reporting and appreciate any help.

Saturday, February 25, 2012

Designing a generic database API

Hi,

My current project requires me to convert a mysql based software to a more generic one. I started by designing separate db class files and separated the lower level connection queries from the business logic. By doing this, I now have mssql.class, mysql.class, sqllite.class etc..

But am not sure how to handle sql functions in queries. For instance, one of my queries need the use of a date function to add minutes to a db field.

In mysql, I accomplish this using

dbfield+interval '$arg' minute between date1 and date1

But in mssql I cannot use this type of query. It seems I'll have to use date_add() function. How do I handle this situation?

My frontend scripting language is php

Thanks d'advance
CeliaI would create a function in your PHP code that takes two arguments, a "date" and an "adder" to the date. That way you can "cook" them as needed for each database engine, while keeping the PHP quite generic.

-PatP

Friday, February 24, 2012

Design table need help

Currently I need to design database table and got stuck.

I have a project and its sub projects. A parent project and its sub projects share the same requirement.The description of the requirement will be changed every day.

For example

Project A - Do Some thing 1 on Project A [09/28/2007]

Project A-A1 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]

Every time the comments updated, both project A and project A-A1 should share the same update i.e select project A and its subproject will be displayed

Project A Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]

Project A-A1 Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29//2007]

When you tried to insert new sub project, the requirement will be shared with the parent project ie.

Project A - Do Some thing 1 on Project A [09/28/2007]

Project A-A1 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]

Project A-A2 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007] , Do Some thing 2 on Project A-A2 [09/30/2007]

assume Project A-A1 and Project A-A2 are sub project of project A

Could anyone show me how to design the database table for those mess?

Thank you

You need 3 table

ProjectGroup

id

name

Project

id

groupID -> ProjectGroup.id

name

ProjectLog

id

groupID ->ProjectGroup.id

note

date_add

Regards,

Max

|||

My previous post don't actually work, my bad.

ProjectGroup

id

name

Project

id

groupID -> ProjectGroup.id

name

ProjectGroupLog

id

groupID ->ProjectGroup.id

note

date_add

ProjectLog

id

projectID ->Project.id

note

date_add

Now when you need to display the logs, just merge the ProjectGroupLog result with the ProjectLog.

|||

Isn't this a self-referential ParentID relationship? You can do it all in one table (I think):

tbProject

ProjectID int IDENTITY (1,1) (PK)

ProjectName nvarchar(255)

ParentProjectID int NOT NULL (FK --> projectID)

TopLevelProjectID int NOT NULL (FK --> ProjectID)

Requirement nvarchar(255)

Create a project, it gets ProjectID = 1, and since it has no Parent, it's ParentID = 1 that means that it's a Top-Level project, so it's TopLevelProjectID = 1.

A sub project would have ProjectID = 2 (or whatever the next avilable ID is), a ParentProjectID = 1, and a TopLevelProjectID = 1.

And, if this sub had a sub, then:

ProjectID = 3 (or next available ID)

ParentID = 2 ('cause that's one level UP from this project)

TopLevelProjectID = 1 ('cuase that the top of the tree from this project)

With this, you can use something like:

Update Set REquirment = Requirment + " SOME NEW STRING " where TopLevelProject = 1

Code Block

create table #Projects(

ProjectID int identity(1,1)

, ParentID int

, TopLevelID int

, ProjectName varchar(255)

, ProjectRequirement varchar(255)

)

insert into #Projects(ProjectName,ParentID,TopLevelID,ProjectRequirement)

select 'Project # 1', 1, 1,'some thing or other'

insert into #Projects(ProjectName,ParentID,TopLevelID,ProjectRequirement)

select 'Project # 2', 2, 2, 'do this now'

insert into #Projects(ProjectName,ParentID,TopLevelID, ProjectRequirement)

select 'Project # 3', 3, 3, ' FOOBAR the 3rd'

insert into #Projects(ProjectName,ParentID,TopLevelID)

select 'Project # 1: Sub A', 1, 1

insert into #Projects(ProjectName,ParentID,TopLevelID)

select 'Project # 2: Sub A', 2, 2

insert into #Projects(ProjectName,ParentID,TopLevelID, ProjectRequirement)

select 'Project # 1: Sub B', 1, 1, 'Hey, here''s another one!!'

insert into #Projects(ProjectName,ParentID,TopLevelID)

select 'Project # 1: Sub A: Sub i', 4, 1

insert into #Projects(ProjectName,ParentID,TopLevelID)

select 'Project # 1: Sub A: Sub ii', 4, 1

insert into #Projects(ProjectName,ParentID,TopLevelID, ProjectRequirement)

select 'Project # 1: Sub A: Sub ii: Sub a:', 8, 1, 'Do it. Do it now!'

insert into #Projects(ProjectName,ParentID,TopLevelID)

select 'Project # 3: Sub A', 3, 3

insert into #Projects(ProjectName,ParentID,TopLevelID)

select 'Project # 3: Sub A: Sub i', 10, 3;

with CTE

as

(

select ProjectName as [ProjectName],ProjectName as [ParentProject],ProjectName as [TopLevelProject], convert(varchar(4000),IsnUll(ProjectRequirement,'')) as [REQ], ProjectID from #Projects where TopLevelID = ProjectID

union all

select P.ProjectName,cte.[ProjectName],cte.[TopLevelProject], convert(varchar(4000),CTE.REQ + ': ' + isnull(ProjectRequirement,'')), p.ProjectID

from CTE inner join #Projects P on P.ParentID = cte.ProjectID

where P.ProjectID <> p.ParentID

and p.ProjectID <> p.TopLevelID

)

select * from CTE order by TopLevelProject, ParentProject

drop table #Projects

|||

You can accomplish this with 2 tables. Parent Table and Child Table or Project Table and Sub Project Table.

Project Table

-->ProjectNo

-->Comment1

-->Comment2

SubProject Table

-->ProjectNo FK

-->SubProjectNo

-->SubComment1

-->SubComment2

Your update on your SubProject would reflect in the Project as follows:

UPDATE sp

SET sp.SubComment1 = 'Did some work', p.Comment1 = 'Did some work on SubProject' & 'A1'

FROM SubProject sp

JOIN Project p on p.ProjectNo = sp.ProjectNo

WHERE sp.SubProjectNo = 'A1' AND p.ProjectNo = 1

As far as your insert statement is concerned, you would use an ON INSERT trigger on the Project Table to create a subrecord in the subproject table.

Adam

Sunday, February 19, 2012

Design Question

Hi all,

I am currently building a project management application.
The users wants to save existing projects as templates.

My question is, what would be the better solution.
Create seperate tables to hold template information.
Or use the same table as the existing project but, flagged as Templates?My feeling is that having one table would be the better solution. Having 2 separate tables with the same file structure is asking for trouble maintenance-wise. Any schema changes would have to be done twice.

Terri|||Yes thats what the IT Manager said and I agree.
But the template data is only varchar name and description type stuff.
Where as the other table has datetime, bit, int etc type fields.
So if I combine the two table I will have to allow for null values.

Is this a problem?|||Well, now it is sounding like the template schema and the project schema are not the same. If you post the schema perhaps better advice can be offered.

And I don't see a problem with allowing for NULL values, as long as you account for them in your coding.

Terri|||Use the same table as your manager said. Fewer tables = simpler design = better program. Also you can easily change templates into project or vice versa if you ever see the need to. (Think easy template creation from existing campaigns?)|||Thanks guys|||Or you can normalize your project table into ProjectHeader and ProjectDetails. Include in the ProjectHeader those fields which are common to templates and projects, and add a ProjectType field to identify it as a project or template. The additional fields that only apply to projects can then be placed in your new ProjectDetails table, along with the foreign key reference to the ProjectHeader table.

This is generally how you would handle object generalizations (or inheritance, whatever terminology you want to use) like this. Shoving it all into one single table can cause problems later - what if you decide you now have more "special cases" of project records?

Friday, February 17, 2012

Design Help!

hi I'm creating a project and i just need some guidance on if my ERD is designed right so i can move on to creating tablesTips and welcomed!...thx...Here are the business rules.

The Ocean Ford dealership wishes to manage data about their car sales. They are interested in keeping information about their customers. They wish to record data about all customers, whether they purchase a car or not this data includes, name, address, phone and what marketing tool brought them into the dealership (recent newspaper ad about a particular vehicle, TV commercial, word of mouth or radio commercial).

When customers leave without purchasing a vehicle, the dealership wishes to ensure a methodical follow up strategy is taken. The dealership wants to record the following:
(1) the date and salesperson who places a telephone call to the customer thanking them for their visit and inviting them to return, as well as the customers response;
(2) The date and the name of the sales manager who places a telephone call to the customer thanking them for their visit and inviting them to return, as well as the customers response to the telephone call and;
(3) The date a letter from the owner or Ocean Ford is sent to the customer thanking them for their visit.

When customers purchase a new vehicle the dealership wishes to record for tracking purposes whether the car purchased is on order or is in current inventory. When a customer purchases a previously owned vehicle they wish to record whether the customer purchases an extended warranty and the mileage at the time of sale.

Ocean Ford also wishes to maintain data about their inventory new and previously owned. Data about cars, trucks, SUVs and minivans include: vehicle identification number, model, exterior color, interior color and year. The cars, Focus and Mustang, both have the additional attribute, package; while the Five Hundred model has the unique attribute, body style. Trucks have a few unique attributes (with the exception of the 2005 E series): cab, box, drive and doors. The SUVs, Escape, Explorer, and Excursion, have the unique attributes, drive and engine. The SUVs, Explorer Sport Track and Expedition, just has the attribute, drive. Although Ocean Ford is contemplating adding commercial trucks to their inventory, currently there are no other types of vehicles in Ocean Fords inventory. Obviously a vehicle can be only one kind of vehicle at a particular time.

A customer may purchase one or more new or used vehicles from inventory and each vehicle is purchased by one or more customers (a new car in inventory may be traded in the next year, entered into inventory and then sold to another customer.) The organization is interested in the date of purchase, amount of sale and salesperson(s) completing the sale.So what's your question?

This looks like a homework assignment. I have no intention of doing your homework but i will consider answering specific questions if you are actually having difficulties with an issue.|||my questions are do i break the vehicle table into new and used or do i just put is as an attribute of VEHICLE?|||my questions are do i break the vehicle table into new and used or do i just put is as an attribute of VEHICLE?

Hi hello_world,

Though I am no SQL pro I have designed a few databases and things like that depend on the individual normally. But my view is that you set that as an Attribute of the Vehicle table. REASON: If you were to make a NewVehicle table and UsedVehicle table, that to me seems a bit redundant. My thing would be to make that an Attribute of Each Vehicle. Then, later when the vehicle is traded back in you only change that attribute which then makes it as though you placed it into a separate table. Also, for reporting purposes, you can base your report on both New and Used and get two views of the data still.
Like I stated, that is the way I would do it and I am not a pro at this at all. But I have done something like this in the past and it worked well for me.

have a nice one,
BUD :)|||Thanks for the help Bud...This is what I concluded

Tuesday, February 14, 2012

Design and Performance question

Hi
I'm working now on a project that is Database oriented, and this
Database is so big and has millions of records, my question is:
Where must I put the business logic?
1- Client side: where client is responsible for the business logic.
2- Server Side: exceute the business logic in the server using stored
procedures and triggers...
3- Hybrid schema load balancing on the two sides.
I'm using MS.SQL Server2000
I have many of very complex queries, and many of complex views.
and finally can I depend on Jobs in MS.SQL Server in some tasks with
out impact the perfermance down.
Please reply ASAP
thanks a lot.
I try to put it where it is best suited.
Anything set based which acts on a large amount of data should be in stored
procs or performance will suffer.
Always interface with the db via SPs as you can monitor and correct problems
and change the database tructure without changing anything outside the db.
Anything not set based is up to you and may just depend on the avalability
of development expertise.
You can rely on jobs. Whether they mipact anything depends on what they do.
"Yousef Absee" wrote:

> Hi
> I'm working now on a project that is Database oriented, and this
> Database is so big and has millions of records, my question is:
> Where must I put the business logic?
> 1- Client side: where client is responsible for the business logic.
> 2- Server Side: exceute the business logic in the server using stored
> procedures and triggers...
> 3- Hybrid schema load balancing on the two sides.
> I'm using MS.SQL Server2000
> I have many of very complex queries, and many of complex views.
> and finally can I depend on Jobs in MS.SQL Server in some tasks with
> out impact the perfermance down.
> Please reply ASAP
> thanks a lot.
>
|||"Yousef Absee" <youstec@.gmail.com> wrote in message
news:1131554866.394769.115640@.g47g2000cwa.googlegr oups.com...
> Where must I put the business logic?
> 1- Client side: where client is responsible for the business logic.
In the bizClasses that are called by the GUI and directly interact with the
db. If that is via metaData it's even better.

> 2- Server Side: exceute the business logic in the server using stored
> procedures and triggers...
Well sure, These rules may not be business rules but basic data handeling
instead. Triggers that generate data in other tables for necessary reasons
is a good thing.

> 3- Hybrid schema load balancing on the two sides.
> I'm using MS.SQL Server2000
> I have many of very complex queries, and many of complex views.
> and finally can I depend on Jobs in MS.SQL Server in some tasks with
> out impact the perfermance down.
Depends on what the job is to do and what is happening at the same time?

Design and Performance question

Hi
I'm working now on a project that is Database oriented, and this
Database is so big and has millions of records, my question is:
Where must I put the business logic?
1- Client side: where client is responsible for the business logic.
2- Server Side: exceute the business logic in the server using stored
procedures and triggers...
3- Hybrid schema load balancing on the two sides.
I'm using MS.SQL Server2000
I have many of very complex queries, and many of complex views.
and finally can I depend on Jobs in MS.SQL Server in some tasks with
out impact the perfermance down.
Please reply ASAP
thanks a lot.I try to put it where it is best suited.
Anything set based which acts on a large amount of data should be in stored
procs or performance will suffer.
Always interface with the db via SPs as you can monitor and correct problems
and change the database tructure without changing anything outside the db.
Anything not set based is up to you and may just depend on the avalability
of development expertise.
You can rely on jobs. Whether they mipact anything depends on what they do.
"Yousef Absee" wrote:
> Hi
> I'm working now on a project that is Database oriented, and this
> Database is so big and has millions of records, my question is:
> Where must I put the business logic?
> 1- Client side: where client is responsible for the business logic.
> 2- Server Side: exceute the business logic in the server using stored
> procedures and triggers...
> 3- Hybrid schema load balancing on the two sides.
> I'm using MS.SQL Server2000
> I have many of very complex queries, and many of complex views.
> and finally can I depend on Jobs in MS.SQL Server in some tasks with
> out impact the perfermance down.
> Please reply ASAP
> thanks a lot.
>|||"Yousef Absee" <youstec@.gmail.com> wrote in message
news:1131554866.394769.115640@.g47g2000cwa.googlegroups.com...
> Where must I put the business logic?
> 1- Client side: where client is responsible for the business logic.
In the bizClasses that are called by the GUI and directly interact with the
db. If that is via metaData it's even better.
> 2- Server Side: exceute the business logic in the server using stored
> procedures and triggers...
Well sure, These rules may not be business rules but basic data handeling
instead. Triggers that generate data in other tables for necessary reasons
is a good thing.
> 3- Hybrid schema load balancing on the two sides.
> I'm using MS.SQL Server2000
> I have many of very complex queries, and many of complex views.
> and finally can I depend on Jobs in MS.SQL Server in some tasks with
> out impact the perfermance down.
Depends on what the job is to do and what is happening at the same time?

Design and Performance question

Hi
I'm working now on a project that is Database oriented, and this
Database is so big and has millions of records, my question is:
Where must I put the business logic?
1- Client side: where client is responsible for the business logic.
2- Server Side: exceute the business logic in the server using stored
procedures and triggers...
3- Hybrid schema load balancing on the two sides.
I'm using MS.SQL Server2000
I have many of very complex queries, and many of complex views.
and finally can I depend on Jobs in MS.SQL Server in some tasks with
out impact the perfermance down.
Please reply ASAP
thanks a lot.I try to put it where it is best suited.
Anything set based which acts on a large amount of data should be in stored
procs or performance will suffer.
Always interface with the db via SPs as you can monitor and correct problems
and change the database tructure without changing anything outside the db.
Anything not set based is up to you and may just depend on the avalability
of development expertise.
You can rely on jobs. Whether they mipact anything depends on what they do.
"Yousef Absee" wrote:

> Hi
> I'm working now on a project that is Database oriented, and this
> Database is so big and has millions of records, my question is:
> Where must I put the business logic?
> 1- Client side: where client is responsible for the business logic.
> 2- Server Side: exceute the business logic in the server using stored
> procedures and triggers...
> 3- Hybrid schema load balancing on the two sides.
> I'm using MS.SQL Server2000
> I have many of very complex queries, and many of complex views.
> and finally can I depend on Jobs in MS.SQL Server in some tasks with
> out impact the perfermance down.
> Please reply ASAP
> thanks a lot.
>|||"Yousef Absee" <youstec@.gmail.com> wrote in message
news:1131554866.394769.115640@.g47g2000cwa.googlegroups.com...
> Where must I put the business logic?
> 1- Client side: where client is responsible for the business logic.
In the bizClasses that are called by the GUI and directly interact with the
db. If that is via metaData it's even better.

> 2- Server Side: exceute the business logic in the server using stored
> procedures and triggers...
Well sure, These rules may not be business rules but basic data handeling
instead. Triggers that generate data in other tables for necessary reasons
is a good thing.

> 3- Hybrid schema load balancing on the two sides.
> I'm using MS.SQL Server2000
> I have many of very complex queries, and many of complex views.
> and finally can I depend on Jobs in MS.SQL Server in some tasks with
> out impact the perfermance down.
Depends on what the job is to do and what is happening at the same time?

Design advice?

I have an construction estimation system, and I want to develop a project management system. I will be using the same database because there are shared tables. My question is this, critical data tables are considered tables with dollar values and these tables should not be shared across the whole company. I do however need information from these tables, such as product and quantity of the product for a given project. When an estimate becomes a project it is assigned a project number. At this point I thought of Copying the required data from the estimate side to the project side. This would result in duplicate data in a sence but the tables will be referenced from two standalone front end applications. Should I copy the data from one table to another, or create new "views" to the estimate tables for the project management portion.

What would be the best solution to this problem? I find in some circumstances, a new table is required because additional data will be saved on the "Project Management" side, but not in all cases.

Mike Bi'd make a new table and transfer contents of estimates table into it once the estimate matures into a project. at least one reason behind it: you can have multiple estimates and all but the final one will stay estimates. i'd also designate a grouping field to identify what estimates may relate to what project (i am talking about estimates that never became a project, but are related to the one that did)|||i'd also designate a grouping field to identify what estimates may relate to what project (i am talking about estimates that never became a project, but are related to the one that did)

I have already done that, it is a "Project Reference ID". Thanks for the input. It is pretty much already what I was thinking, but.....I am very under confident in my decisions (inexperience I guess).

Mike B