What are these diagrams in each database used for?
If I make a link betwwen two tables in a diagram ,,does it affect the
relationships'
Why dosn't it detect the relations between the tables'
ThanksThey are a simple ERD tool for visualising the schema of your database.
Changes to relationships in a diagram will affect your schema (it will
prompt to warn you).If you don't have foreign key relationships setup then
it won't be able to automatically determine the table relations.
--
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Reza Alirezaei" <anonymous@.discussions.microsoft.com> wrote in message
news:e$xI1SEPEHA.1388@.TK2MSFTNGP09.phx.gbl...
> What are these diagrams in each database used for?
> If I make a link betwwen two tables in a diagram ,,does it affect the
> relationships'
> Why dosn't it detect the relations between the tables'
> Thanks
>|||How can I setup a foreign key while I'm designing a tabel?
"Jasper Smith" <jasper_smith9@.hotmail.com> wrote in message
news:O3a59pEPEHA.252@.TK2MSFTNGP10.phx.gbl...
> They are a simple ERD tool for visualising the schema of your database.
> Changes to relationships in a diagram will affect your schema (it will
> prompt to warn you).If you don't have foreign key relationships setup then
> it won't be able to automatically determine the table relations.
> --
> HTH
> Jasper Smith (SQL Server MVP)
> I support PASS - the definitive, global
> community for SQL Server professionals -
> http://www.sqlpass.org
>
> "Reza Alirezaei" <anonymous@.discussions.microsoft.com> wrote in message
> news:e$xI1SEPEHA.1388@.TK2MSFTNGP09.phx.gbl...
> > What are these diagrams in each database used for?
> > If I make a link betwwen two tables in a diagram ,,does it affect the
> > relationships'
> > Why dosn't it detect the relations between the tables'
> >
> > Thanks
> >
> >
>|||Reza,
CREATE TABLE master_table
(
master_id INT NOT NULL PRIMARY KEY,
master_name VARCHAR(200)
)
--One way of creating a Foreign Key
CREATE TABLE child_table
(
child_id INT NOT NULL PRIMARY KEY,
master_id INT NOT NULL REFERENCES master_table(master_id),
child_name VARCHAR(200)
)
--Another way, using Alter table
ALTER TABLE [dbo].[child_tyable] ADD
FOREIGN KEY
(
[master_id]
) REFERENCES [dbo].[master_table] (
[master_id]
)
GO
You can find basic tsql syntax in BooksOnLine.
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Reza Alirezaei" <anonymous@.discussions.microsoft.com> wrote in message
news:#jDyX8EPEHA.3016@.tk2msftngp13.phx.gbl...
> How can I setup a foreign key while I'm designing a tabel?
> "Jasper Smith" <jasper_smith9@.hotmail.com> wrote in message
> news:O3a59pEPEHA.252@.TK2MSFTNGP10.phx.gbl...
> > They are a simple ERD tool for visualising the schema of your database.
> > Changes to relationships in a diagram will affect your schema (it will
> > prompt to warn you).If you don't have foreign key relationships setup
then
> > it won't be able to automatically determine the table relations.
> >
> > --
> > HTH
> >
> > Jasper Smith (SQL Server MVP)
> >
> > I support PASS - the definitive, global
> > community for SQL Server professionals -
> > http://www.sqlpass.org
> >
> >
> > "Reza Alirezaei" <anonymous@.discussions.microsoft.com> wrote in message
> > news:e$xI1SEPEHA.1388@.TK2MSFTNGP09.phx.gbl...
> > > What are these diagrams in each database used for?
> > > If I make a link betwwen two tables in a diagram ,,does it affect the
> > > relationships'
> > > Why dosn't it detect the relations between the tables'
> > >
> > > Thanks
> > >
> > >
> >
> >
>|||You can also drag and drop in columns in the diagram itself to visually
create your relationships however I would recomend the approcah from Dinesh
i.e. explicitly create them as part of your schema as its too easy to get
things the wrong way round using the diagram tool.
--
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Dinesh T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
news:uaAAHKFPEHA.3052@.TK2MSFTNGP09.phx.gbl...
> Reza,
> CREATE TABLE master_table
> (
> master_id INT NOT NULL PRIMARY KEY,
> master_name VARCHAR(200)
> )
> --One way of creating a Foreign Key
> CREATE TABLE child_table
> (
> child_id INT NOT NULL PRIMARY KEY,
> master_id INT NOT NULL REFERENCES master_table(master_id),
> child_name VARCHAR(200)
> )
> --Another way, using Alter table
> ALTER TABLE [dbo].[child_tyable] ADD
> FOREIGN KEY
> (
> [master_id]
> ) REFERENCES [dbo].[master_table] (
> [master_id]
> )
> GO
> You can find basic tsql syntax in BooksOnLine.
>
> --
> Dinesh
> SQL Server MVP
> --
> --
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Reza Alirezaei" <anonymous@.discussions.microsoft.com> wrote in message
> news:#jDyX8EPEHA.3016@.tk2msftngp13.phx.gbl...
> > How can I setup a foreign key while I'm designing a tabel?
> >
> > "Jasper Smith" <jasper_smith9@.hotmail.com> wrote in message
> > news:O3a59pEPEHA.252@.TK2MSFTNGP10.phx.gbl...
> > > They are a simple ERD tool for visualising the schema of your
database.
> > > Changes to relationships in a diagram will affect your schema (it will
> > > prompt to warn you).If you don't have foreign key relationships setup
> then
> > > it won't be able to automatically determine the table relations.
> > >
> > > --
> > > HTH
> > >
> > > Jasper Smith (SQL Server MVP)
> > >
> > > I support PASS - the definitive, global
> > > community for SQL Server professionals -
> > > http://www.sqlpass.org
> > >
> > >
> > > "Reza Alirezaei" <anonymous@.discussions.microsoft.com> wrote in
message
> > > news:e$xI1SEPEHA.1388@.TK2MSFTNGP09.phx.gbl...
> > > > What are these diagrams in each database used for?
> > > > If I make a link betwwen two tables in a diagram ,,does it affect
the
> > > > relationships'
> > > > Why dosn't it detect the relations between the tables'
> > > >
> > > > Thanks
> > > >
> > > >
> > >
> > >
> >
> >
>
No comments:
Post a Comment