Sunday, March 11, 2012

Database Diagrams / Alter Table

(Repost. Originally posted as a reply in the correct thread.)
You are correct in the assumption that the application works due to the
error checking.
I'm working with Mike on this problem and somewhere along the line, all of
the keys got dropped in the production database. We want to recreate them
in the development database and then run the scripts against the production
database to create the keys and the relationships that are required. Is
there any way to automatically compare two versions of the database and
generate a batch of the ALTER TABLE commands? Or am I looking at
writing each statement individually?
Thanks
Dave
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:uGKT3TRVDHA.2192@.TK2MSFTNGP10.phx.gbl...
> Check if the FKs are in place. Use sp_help and sp_foreignkeys system SPs
to
> check if FKs are present. You can add them, if they are not in place,
using
> the ALTER TABLE command. If the application respects them, if it has input
> validation & error handling, you should have no problem.
>
> --
> Dejan Sarka, SQL Server MVP
> FAQ from Neil & others at: http://www.sqlserverfaq.com
> Please reply only to the newsgroups.
> PASS - the definitive, global community
> for SQL Server professionals - http://www.sqlpass.org
>
> "Mike" <Mike149@.yahoo.com> wrote in message
> news:312f01c35514$024662e0$a001280a@.phx.gbl...
> > I have a question concerning the diagramming tool in SQL
> > Server 2000. On the development server the keys show up
> > in the table view of the Enterprise Manager and the
> > diagramming tool works as expected. However, when we
> > imported the database into production, the keys did not
> > come forward so the diagramming tool cannot diagram
> > relationships. The interesting thing is that the
> > application works as expected, except the keys dont show
> > up in the table view.
> >
> > Question...how is this possible? How do I add the keys
> > to the design without disrupting the application?
> >
> > Thanx
>
>I am using the diff tool from http://www.adeptsql.com/
they have an 30 day trial of the software.
It does an great job on comparing Databases where the only difference is FK
not in one of them.
I delete on the FKs on one of my test DBs several times yesterday;
and then I use the diff tool to compare my tests DBs to each other and
high-light the FKs and have the Diff tool create the ALTER Table commands.
Note: I cut and paste the command into QA to run them sometimes.
FYI: It does not yet handle permissions on objects.
"Dave" <dave@.glimmernet.com> wrote in message
news:%23PLD0FDWDHA.2464@.TK2MSFTNGP09.phx.gbl...
> (Repost. Originally posted as a reply in the correct thread.)
> You are correct in the assumption that the application works due to the
> error checking.
> I'm working with Mike on this problem and somewhere along the line, all of
> the keys got dropped in the production database. We want to recreate them
> in the development database and then run the scripts against the
production
> database to create the keys and the relationships that are required. Is
> there any way to automatically compare two versions of the database and
> generate a batch of the ALTER TABLE commands? Or am I looking at
> writing each statement individually?
> Thanks
> Dave
>
> "Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
> message news:uGKT3TRVDHA.2192@.TK2MSFTNGP10.phx.gbl...
> > Check if the FKs are in place. Use sp_help and sp_foreignkeys system SPs
> to
> > check if FKs are present. You can add them, if they are not in place,
> using
> > the ALTER TABLE command. If the application respects them, if it has
input
> > validation & error handling, you should have no problem.
> >
> > --
> > Dejan Sarka, SQL Server MVP
> > FAQ from Neil & others at: http://www.sqlserverfaq.com
> > Please reply only to the newsgroups.
> > PASS - the definitive, global community
> > for SQL Server professionals - http://www.sqlpass.org
> >
> > "Mike" <Mike149@.yahoo.com> wrote in message
> > news:312f01c35514$024662e0$a001280a@.phx.gbl...
> > > I have a question concerning the diagramming tool in SQL
> > > Server 2000. On the development server the keys show up
> > > in the table view of the Enterprise Manager and the
> > > diagramming tool works as expected. However, when we
> > > imported the database into production, the keys did not
> > > come forward so the diagramming tool cannot diagram
> > > relationships. The interesting thing is that the
> > > application works as expected, except the keys dont show
> > > up in the table view.
> > >
> > > Question...how is this possible? How do I add the keys
> > > to the design without disrupting the application?
> > >
> > > Thanx
> >
> >
>
>|||You could also use DB Ghost www.dbghost.com which does
handle object permissions.
>--Original Message--
>This sounds like it'll work for what I need - I'll look
into it.
>Thanks, Tim
>Dave
>
>"Tim S" <stahta01@.juno.com> wrote in message
>news:38xWa.1585$GN6.331@.fe01.atl2.webusenet.com...
>> I am using the diff tool from http://www.adeptsql.com/
>> they have an 30 day trial of the software.
>> It does an great job on comparing Databases where the
only difference is
>FK
>> not in one of them.
>> I delete on the FKs on one of my test DBs several
times yesterday;
>> and then I use the diff tool to compare my tests DBs
to each other and
>> high-light the FKs and have the Diff tool create the
ALTER Table commands.
>> Note: I cut and paste the command into QA to run them
sometimes.
>> FYI: It does not yet handle permissions on objects.
>>
>> "Dave" <dave@.glimmernet.com> wrote in message
>> news:%23PLD0FDWDHA.2464@.TK2MSFTNGP09.phx.gbl...
>> > (Repost. Originally posted as a reply in the
correct thread.)
>> >
>> > You are correct in the assumption that the
application works due to the
>> > error checking.
>> >
>> > I'm working with Mike on this problem and somewhere
along the line, all
>of
>> > the keys got dropped in the production database. We
want to recreate
>them
>> > in the development database and then run the scripts
against the
>> production
>> > database to create the keys and the relationships
that are required. Is
>> > there any way to automatically compare two versions
of the database and
>> > generate a batch of the ALTER TABLE commands? Or am
I looking at
>> > writing each statement individually?
>> >
>> > Thanks
>> >
>> > Dave
>> >
>> >
>> >
>> > "Dejan Sarka"
<dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote
>in
>> > message news:uGKT3TRVDHA.2192@.TK2MSFTNGP10.phx.gbl...
>> > > Check if the FKs are in place. Use sp_help and
sp_foreignkeys system
>SPs
>> > to
>> > > check if FKs are present. You can add them, if
they are not in place,
>> > using
>> > > the ALTER TABLE command. If the application
respects them, if it has
>> input
>> > > validation & error handling, you should have no
problem.
>> > >
>> > > --
>> > > Dejan Sarka, SQL Server MVP
>> > > FAQ from Neil & others at:
http://www.sqlserverfaq.com
>> > > Please reply only to the newsgroups.
>> > > PASS - the definitive, global community
>> > > for SQL Server professionals -
http://www.sqlpass.org
>> > >
>> > > "Mike" <Mike149@.yahoo.com> wrote in message
>> > > news:312f01c35514$024662e0$a001280a@.phx.gbl...
>> > > > I have a question concerning the diagramming
tool in SQL
>> > > > Server 2000. On the development server the keys
show up
>> > > > in the table view of the Enterprise Manager and
the
>> > > > diagramming tool works as expected. However,
when we
>> > > > imported the database into production, the keys
did not
>> > > > come forward so the diagramming tool cannot
diagram
>> > > > relationships. The interesting thing is that the
>> > > > application works as expected, except the keys
dont show
>> > > > up in the table view.
>> > > >
>> > > > Question...how is this possible? How do I add
the keys
>> > > > to the design without disrupting the application?
>> > > >
>> > > > Thanx
>> > >
>> > >
>> >
>> >
>> >
>>
>
>.
>

No comments:

Post a Comment