Showing posts with label diagrams. Show all posts
Showing posts with label diagrams. Show all posts

Sunday, March 11, 2012

Database Diagrams: FOREIGN KEY constraint "fell off"; can't drop/recreate it...

Hello,

I have two tables Person & Location where Location has a primary key LocationId and Person has a foreign key LocationId.

Sometime ago I used the Database Diagrams visual tool of SQL Server Management Studio Express to create the foreign key relationship between the two tables - i.e. "visually" (drawing a line between the PK & FK LocationId elements of both tables).

Time has passed and I recently noticed that, upon retrieving my saved diagram, the foreign key relationship had "fallen off" (i.e. the many-to-one line was no longer showing in the diagram).

After recreating the relationship (redrawing the line) I find that I get an error message when I try to save the diagram:

Post-Save Notifications
[!] Errors were encountered during the save process. Some database objects were not saved.

'Location' table saved successfully
'Person' table
- Unable to create relationship 'FK_Person_Location'.
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Person_Location". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.

When I go back to the object explorer and view the dependencies for the two tables, there is no dependency (between these two tables) revealed. When I try to create the foreign key constraint manually (T-SQL) it again says can't add the constraint. It comes up with an error as follows:

ALTER TABLE Person
ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

Msg 547, Level 16, State 0, Line 2
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__Person__LocationId__793DFFAF". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.

(Note: Each time I do this, the 8 hexadecimal character suffix changes.)

When I try to drop the foreign key:

alter table Person
drop constraint FK__Person__LocationId

it comes back with the error:

Msg 3728, Level 16, State 1, Line 2
'FK__Person__LocationId' is not a constraint.
Msg 3727, Level 16, State 0, Line 2
Could not drop constraint. See previous errors.

So it seems that there's some kind of goof up here. Can anybody shed light on this / tell me how to fix it?

Best guess, you have data that will not pass the Foreign key constraint. As for why it "dropped off" that is a totally different question that can;t be answered here (do your developers have dbo access and possibly dropped the constraint so they could insert invalid data to make the UI work? (no offense to any developer who wouldn't do that :) )

create table person
(
personId int constraint PKperson primary key,
locationId int
)
insert into person
values (1,1)
insert into person
values (2,2)

create table location
(
locationId int constraint PKlocation primary key
)

ALTER TABLE Person
ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__person__location__4B0D20AB". The conflict occurred in database "master", table "dbo.location", column 'locationId'.

Better to name the constraint:
ALTER TABLE Person
ADD Constraint FKPerson_References_Location FOREIGN KEY (LocationId) REFERENCES Location (LocationId)


Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FKPerson_References_Location". The conflict occurred in database "master", table "dbo.location", column 'locationId'.


insert into location
values (1)
insert into location
values (2)

ALTER TABLE Person
ADD Constraint FKPerson_References_Location FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

to see the constraints and the columns you can use this query:

select *
from information_schema.constraint_column_usage as ccu
join information_schema.referential_constraints as rc
on rc.constraint_schema = ccu.table_schema
and ccu.constraint_name = rc.constraint_name
where ccu.table_name = 'person'

Also, if you want to ignore the invalid data there is a NOCHECK clause when creating constraints, but it is highly advised to not use it.

|||

Thanks Louis for the useful info. It helped in examining the problem more closely.

In the end I decided just to save off my data from the Location table, and to drop / recreate it. Everything is working fine again. I really believe that an inconsistency got in the system tables somewhere - that was my main concern. By dropping / recreating the problem table I believe I eliminated the inconsistency.

|||I get the same error. I wish I could find the source of it in the system tables (or wherever the cause is located) and fix it - I do not have the luxury of merely trying to drop and recreata the tables.|||

Hi all,

I have the same error. But only on my table that I migrate from SQL 2000 to SQL 2005.

And I can't drop and recreate table.

How can I do ?

|||

The ALTER TABLE that you were using does not have a constraint name specified so SQL Server will generate a name automatically and since constraint names have to be unique SQL Server uses combination of table / column names / unique number to make it unique. But it looks like you never had the FK constraint defined so the tables would have contained invalid data. And when you tried to create the constraint from the diagram designer it failed and the constraint creation gets rolled back. You could have checked the data in the table like below to find the offending rows:

select *

from Person as p

where not exists(

select * from Location as l

where l.LocationId = p.LocationId

)

But you shouldn't use diagram designer as the modelling tool. It is not designed for that. It does lot of things behind the scenes which is unnecessary in some cases (like dropping & recreating tables to make certain schema changes). You could make simple schema changes but script out the schema definitions and store it in files.

Database Diagrams: FOREIGN KEY constraint "fell off"; can't drop/recreate it...

Hello,

I have two tables Person & Location where Location has a primary key LocationId and Person has a foreign key LocationId.

Sometime ago I used the Database Diagrams visual tool of SQL Server Management Studio Express to create the foreign key relationship between the two tables - i.e. "visually" (drawing a line between the PK & FK LocationId elements of both tables).

Time has passed and I recently noticed that, upon retrieving my saved diagram, the foreign key relationship had "fallen off" (i.e. the many-to-one line was no longer showing in the diagram).

After recreating the relationship (redrawing the line) I find that I get an error message when I try to save the diagram:

Post-Save Notifications
[!] Errors were encountered during the save process. Some database objects were not saved.

'Location' table saved successfully
'Person' table
- Unable to create relationship 'FK_Person_Location'.
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Person_Location". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.

When I go back to the object explorer and view the dependencies for the two tables, there is no dependency (between these two tables) revealed. When I try to create the foreign key constraint manually (T-SQL) it again says can't add the constraint. It comes up with an error as follows:

ALTER TABLE Person
ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

Msg 547, Level 16, State 0, Line 2
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__Person__LocationId__793DFFAF". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.

(Note: Each time I do this, the 8 hexadecimal character suffix changes.)

When I try to drop the foreign key:

alter table Person
drop constraint FK__Person__LocationId

it comes back with the error:

Msg 3728, Level 16, State 1, Line 2
'FK__Person__LocationId' is not a constraint.
Msg 3727, Level 16, State 0, Line 2
Could not drop constraint. See previous errors.

So it seems that there's some kind of goof up here. Can anybody shed light on this / tell me how to fix it?

Best guess, you have data that will not pass the Foreign key constraint. As for why it "dropped off" that is a totally different question that can;t be answered here (do your developers have dbo access and possibly dropped the constraint so they could insert invalid data to make the UI work? (no offense to any developer who wouldn't do that :) )

create table person
(
personId int constraint PKperson primary key,
locationId int
)
insert into person
values (1,1)
insert into person
values (2,2)

create table location
(
locationId int constraint PKlocation primary key
)

ALTER TABLE Person
ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__person__location__4B0D20AB". The conflict occurred in database "master", table "dbo.location", column 'locationId'.

Better to name the constraint:
ALTER TABLE Person
ADD Constraint FKPerson_References_Location FOREIGN KEY (LocationId) REFERENCES Location (LocationId)


Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FKPerson_References_Location". The conflict occurred in database "master", table "dbo.location", column 'locationId'.


insert into location
values (1)
insert into location
values (2)

ALTER TABLE Person
ADD Constraint FKPerson_References_Location FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

to see the constraints and the columns you can use this query:

select *
from information_schema.constraint_column_usage as ccu
join information_schema.referential_constraints as rc
on rc.constraint_schema = ccu.table_schema
and ccu.constraint_name = rc.constraint_name
where ccu.table_name = 'person'

Also, if you want to ignore the invalid data there is a NOCHECK clause when creating constraints, but it is highly advised to not use it.

|||

Thanks Louis for the useful info. It helped in examining the problem more closely.

In the end I decided just to save off my data from the Location table, and to drop / recreate it. Everything is working fine again. I really believe that an inconsistency got in the system tables somewhere - that was my main concern. By dropping / recreating the problem table I believe I eliminated the inconsistency.

|||I get the same error. I wish I could find the source of it in the system tables (or wherever the cause is located) and fix it - I do not have the luxury of merely trying to drop and recreata the tables.|||

Hi all,

I have the same error. But only on my table that I migrate from SQL 2000 to SQL 2005.

And I can't drop and recreate table.

How can I do ?

|||

The ALTER TABLE that you were using does not have a constraint name specified so SQL Server will generate a name automatically and since constraint names have to be unique SQL Server uses combination of table / column names / unique number to make it unique. But it looks like you never had the FK constraint defined so the tables would have contained invalid data. And when you tried to create the constraint from the diagram designer it failed and the constraint creation gets rolled back. You could have checked the data in the table like below to find the offending rows:

select *

from Person as p

where not exists(

select * from Location as l

where l.LocationId = p.LocationId

)

But you shouldn't use diagram designer as the modelling tool. It is not designed for that. It does lot of things behind the scenes which is unnecessary in some cases (like dropping & recreating tables to make certain schema changes). You could make simple schema changes but script out the schema definitions and store it in files.

Database Diagrams: FOREIGN KEY constraint "fell off"; can't drop/recreate it...

Hello,

I have two tables Person & Location where Location has a primary key LocationId and Person has a foreign key LocationId.

Sometime ago I used the Database Diagrams visual tool of SQL Server Management Studio Express to create the foreign key relationship between the two tables - i.e. "visually" (drawing a line between the PK & FK LocationId elements of both tables).

Time has passed and I recently noticed that, upon retrieving my saved diagram, the foreign key relationship had "fallen off" (i.e. the many-to-one line was no longer showing in the diagram).

After recreating the relationship (redrawing the line) I find that I get an error message when I try to save the diagram:

Post-Save Notifications
[!] Errors were encountered during the save process. Some database objects were not saved.

'Location' table saved successfully
'Person' table
- Unable to create relationship 'FK_Person_Location'.
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Person_Location". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.

When I go back to the object explorer and view the dependencies for the two tables, there is no dependency (between these two tables) revealed. When I try to create the foreign key constraint manually (T-SQL) it again says can't add the constraint. It comes up with an error as follows:

ALTER TABLE Person
ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

Msg 547, Level 16, State 0, Line 2
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__Person__LocationId__793DFFAF". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.

(Note: Each time I do this, the 8 hexadecimal character suffix changes.)

When I try to drop the foreign key:

alter table Person
drop constraint FK__Person__LocationId

it comes back with the error:

Msg 3728, Level 16, State 1, Line 2
'FK__Person__LocationId' is not a constraint.
Msg 3727, Level 16, State 0, Line 2
Could not drop constraint. See previous errors.

So it seems that there's some kind of goof up here. Can anybody shed light on this / tell me how to fix it?

Best guess, you have data that will not pass the Foreign key constraint. As for why it "dropped off" that is a totally different question that can;t be answered here (do your developers have dbo access and possibly dropped the constraint so they could insert invalid data to make the UI work? (no offense to any developer who wouldn't do that :) )

create table person
(
personId int constraint PKperson primary key,
locationId int
)
insert into person
values (1,1)
insert into person
values (2,2)

create table location
(
locationId int constraint PKlocation primary key
)

ALTER TABLE Person
ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__person__location__4B0D20AB". The conflict occurred in database "master", table "dbo.location", column 'locationId'.

Better to name the constraint:
ALTER TABLE Person
ADD Constraint FKPerson_References_Location FOREIGN KEY (LocationId) REFERENCES Location (LocationId)


Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FKPerson_References_Location". The conflict occurred in database "master", table "dbo.location", column 'locationId'.


insert into location
values (1)
insert into location
values (2)

ALTER TABLE Person
ADD Constraint FKPerson_References_Location FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

to see the constraints and the columns you can use this query:

select *
from information_schema.constraint_column_usage as ccu
join information_schema.referential_constraints as rc
on rc.constraint_schema = ccu.table_schema
and ccu.constraint_name = rc.constraint_name
where ccu.table_name = 'person'

Also, if you want to ignore the invalid data there is a NOCHECK clause when creating constraints, but it is highly advised to not use it.

|||

Thanks Louis for the useful info. It helped in examining the problem more closely.

In the end I decided just to save off my data from the Location table, and to drop / recreate it. Everything is working fine again. I really believe that an inconsistency got in the system tables somewhere - that was my main concern. By dropping / recreating the problem table I believe I eliminated the inconsistency.

|||I get the same error. I wish I could find the source of it in the system tables (or wherever the cause is located) and fix it - I do not have the luxury of merely trying to drop and recreata the tables.|||

Hi all,

I have the same error. But only on my table that I migrate from SQL 2000 to SQL 2005.

And I can't drop and recreate table.

How can I do ?

|||

The ALTER TABLE that you were using does not have a constraint name specified so SQL Server will generate a name automatically and since constraint names have to be unique SQL Server uses combination of table / column names / unique number to make it unique. But it looks like you never had the FK constraint defined so the tables would have contained invalid data. And when you tried to create the constraint from the diagram designer it failed and the constraint creation gets rolled back. You could have checked the data in the table like below to find the offending rows:

select *

from Person as p

where not exists(

select * from Location as l

where l.LocationId = p.LocationId

)

But you shouldn't use diagram designer as the modelling tool. It is not designed for that. It does lot of things behind the scenes which is unnecessary in some cases (like dropping & recreating tables to make certain schema changes). You could make simple schema changes but script out the schema definitions and store it in files.

Database Diagrams: FOREIGN KEY constraint "fell off"; can't drop/recreate it...

Hello,

I have two tables Person & Location where Location has a primary key LocationId and Person has a foreign key LocationId.

Sometime ago I used the Database Diagrams visual tool of SQL Server Management Studio Express to create the foreign key relationship between the two tables - i.e. "visually" (drawing a line between the PK & FK LocationId elements of both tables).

Time has passed and I recently noticed that, upon retrieving my saved diagram, the foreign key relationship had "fallen off" (i.e. the many-to-one line was no longer showing in the diagram).

After recreating the relationship (redrawing the line) I find that I get an error message when I try to save the diagram:

Post-Save Notifications
[!] Errors were encountered during the save process. Some database objects were not saved.

'Location' table saved successfully
'Person' table
- Unable to create relationship 'FK_Person_Location'.
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Person_Location". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.

When I go back to the object explorer and view the dependencies for the two tables, there is no dependency (between these two tables) revealed. When I try to create the foreign key constraint manually (T-SQL) it again says can't add the constraint. It comes up with an error as follows:

ALTER TABLE Person
ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

Msg 547, Level 16, State 0, Line 2
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__Person__LocationId__793DFFAF". The conflict occurred in database "mydb", table "dbo.Location", column 'LocationId'.

(Note: Each time I do this, the 8 hexadecimal character suffix changes.)

When I try to drop the foreign key:

alter table Person
drop constraint FK__Person__LocationId

it comes back with the error:

Msg 3728, Level 16, State 1, Line 2
'FK__Person__LocationId' is not a constraint.
Msg 3727, Level 16, State 0, Line 2
Could not drop constraint. See previous errors.

So it seems that there's some kind of goof up here. Can anybody shed light on this / tell me how to fix it?

Best guess, you have data that will not pass the Foreign key constraint. As for why it "dropped off" that is a totally different question that can;t be answered here (do your developers have dbo access and possibly dropped the constraint so they could insert invalid data to make the UI work? (no offense to any developer who wouldn't do that :) )

create table person
(
personId int constraint PKperson primary key,
locationId int
)
insert into person
values (1,1)
insert into person
values (2,2)

create table location
(
locationId int constraint PKlocation primary key
)

ALTER TABLE Person
ADD FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK__person__location__4B0D20AB". The conflict occurred in database "master", table "dbo.location", column 'locationId'.

Better to name the constraint:
ALTER TABLE Person
ADD Constraint FKPerson_References_Location FOREIGN KEY (LocationId) REFERENCES Location (LocationId)


Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FKPerson_References_Location". The conflict occurred in database "master", table "dbo.location", column 'locationId'.


insert into location
values (1)
insert into location
values (2)

ALTER TABLE Person
ADD Constraint FKPerson_References_Location FOREIGN KEY (LocationId) REFERENCES Location (LocationId)

to see the constraints and the columns you can use this query:

select *
from information_schema.constraint_column_usage as ccu
join information_schema.referential_constraints as rc
on rc.constraint_schema = ccu.table_schema
and ccu.constraint_name = rc.constraint_name
where ccu.table_name = 'person'

Also, if you want to ignore the invalid data there is a NOCHECK clause when creating constraints, but it is highly advised to not use it.

|||

Thanks Louis for the useful info. It helped in examining the problem more closely.

In the end I decided just to save off my data from the Location table, and to drop / recreate it. Everything is working fine again. I really believe that an inconsistency got in the system tables somewhere - that was my main concern. By dropping / recreating the problem table I believe I eliminated the inconsistency.

|||I get the same error. I wish I could find the source of it in the system tables (or wherever the cause is located) and fix it - I do not have the luxury of merely trying to drop and recreata the tables.|||

Hi all,

I have the same error. But only on my table that I migrate from SQL 2000 to SQL 2005.

And I can't drop and recreate table.

How can I do ?

|||

The ALTER TABLE that you were using does not have a constraint name specified so SQL Server will generate a name automatically and since constraint names have to be unique SQL Server uses combination of table / column names / unique number to make it unique. But it looks like you never had the FK constraint defined so the tables would have contained invalid data. And when you tried to create the constraint from the diagram designer it failed and the constraint creation gets rolled back. You could have checked the data in the table like below to find the offending rows:

select *

from Person as p

where not exists(

select * from Location as l

where l.LocationId = p.LocationId

)

But you shouldn't use diagram designer as the modelling tool. It is not designed for that. It does lot of things behind the scenes which is unnecessary in some cases (like dropping & recreating tables to make certain schema changes). You could make simple schema changes but script out the schema definitions and store it in files.

Database Diagrams, SQL Server 2005

Hi everyone,

I was wondering if there is any way to generate a database diagram with foreign key relationships automatically generated between tables in SQL Server 2005... My initial investigations has yielded no, but I'd like to be sure.

Thank you

Chris

The database diagramming tool won't automatically create foreign key contraints on your tables. You can explicitly create foreign key relationships in a diagram by clicking on one table and dragging the relationship line to the related table.

If you have two existing tables with a foreign key relating them, the relationship line should automatically display in the diagram as soon as you add both tables to the diagram.

Hope this helps,
Steve

|||Thank you very much Steve, very helpful.

Database Diagrams tool

When I use the sql 2005 "Database Diagrams" tool for the first time I always get the message: "The Database does not have one or more of the support objects required to use database diagramming. Do you wish to create them?"

1. Does anyone know what the " support objects" referred to are?

2. Why SQL doesn't automatically create these support objects for me? (e.g. do they require a lot of hard disk space so they shouldn't routinely be created?)

3. Is there any way to make Sql automatically create them?

If you can address any of these points I'd appreciate it.

TIA,

barkingdog


The support objects are the following objects that will be created during the action:

sp_helpdiagramdefinition
sp_creatediagram
sp_renamediagram
sp_alterdiagram
sp_dropdiagram
fn_diagramobjects
sp_upgraddiagrams
sysdiagrams
PK__sysdiagrams__ID
UK_principal_name
sp_helpdiagrams

I don′t know why they are not created at creation time of the database, but you can influence this design by creating the definitions once in the model database. As the model database is the template for new database, once theay are created here, they will exists in every new database.


HTH, Jens SUessmeyer.


http://www.sqlserver2005.de

|||

I create all my databases from a script, and I can't always guarantee the model database design.

Is there a single system sproc that can be called to generate all those bits?

Otherwise - what's the best way to get all those bits into the model database? You can't add a diagram to the model database..

Thanks...

|||


As noone prevents you from scripting the stored procedures and related objects, just script them and put them in your custom script you are executing.

HTH, Jens SUessmeyer.


http://www.sqlserver2005.de

Database Diagrams Problem....

Hi all,
I am trying to make DATABASE DIAGRAMs...I have restored a database called Tel from a backup file...n in that i have all the tables and procedures..now whenever i m clicking on its DATABASE DIAGRAMS it gives me the error as:

TITLE: Microsoft SQL Server Management Studio
----------

Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.

----------
so,what should i do??any suggestion will be helpful for me...thnks in advance...
regards..Try:

exec sp_changedbowner 'sa'

Database diagrams problem

Hi, I restored my 2000 database in Microsoft SQL Management Studio 2005 but
a cannot reach the Database Diagram. I get the message:
--
Database diagram support objects cannot be installed because this database
does not have a valid owner. To continue, first use the Files page of the
Database Properties dialog box or the ALTER AUTHORIZATION statement to set
the database owner to a valid login, then add the database diagram support
objects.
--
I used File pages but I don't know how to set a valid owner.
AKAssuming you don't have SP1 installed, then it's likely that your updated
database is still in 80 compatability level. See the Important note in this
Books Online topic (http://msdn2.microsoft.com/en-us/library/ms186345.aspx).
SP1contains a fix to this problem.
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of Books Online from
http://www.microsoft.com/technet/pr...oads/books.mspx
"Anatoly Kurilin" <akurilin@.nordsoft.ru> wrote in message
news:%23rhyXFotGHA.4852@.TK2MSFTNGP02.phx.gbl...
> Hi, I restored my 2000 database in Microsoft SQL Management Studio 2005
> but a cannot reach the Database Diagram. I get the message:
> --
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of the
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
> --
> I used File pages but I don't know how to set a valid owner.
> AK
>

Database Diagrams on SQL 2000

So there is no way to create a Database diagram on a SQL 2000 database using
SQL Server management studio 2005 even though that database diagrams is not
a
new feature?
ThanksHi Lazer,
Thats right, you should use SQL Enterprise Manager to admin/create database
diagrams on SQL Server 2000.
You can use Management Studio only to create diagrams against SQL Server
2005 servers and databases.
Tony.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"Lazer" <Lazer@.discussions.microsoft.com> wrote in message
news:3F59CE7A-30EE-4D63-9F75-9341AF211698@.microsoft.com...
> So there is no way to create a Database diagram on a SQL 2000 database
> using
> SQL Server management studio 2005 even though that database diagrams is
> not a
> new feature?
> Thanks

Database Diagrams in SQL server 2005

Hello, i'm new to this forum but I need help with SQL Server 2005. I know on 2003 you can do database diagrams to create table diagrams to show the relationships. But for 2005 it won't allow me to do database diagrams. When I click on my database in Object or Solution explorer, I right click on database diagrams and it doesn't give me the option to do a database diagram. It just gives me a help option ("Working with SQL server 2000 diagrams"). I don't why it gives this option, because I'm using the 2005 version. Does anyone know how to elect to do database diagrams in SQL Server 2005? I would appreciate the help.

Not quite sure what problem you're running into...

Are you using SQL Server Management Studio or Visual Studio? You should be using SQL Server Management Studio.

What version of the SSMS are you using? Go to the Help -> About menu. Then look for these: 9.0.1399, 9.0.2047, Express, Developer.

You should be able to right click on the Database Diagrams node and choose "New Database Diagram"

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

|||

Management Studio can't create or open diagrams on SQL Server 2000 servers. Are you connected to a SQL Server 2000 server, or a SQL Server 2005 server?

Thanks,
Steve

|||Thanks Steve, I'm connecting to SQL Server 2000 server, I wasn't aware you couldn't create diagrams if connected to that server. That answers my question, thanks.

Database Diagrams in SQL 2005

I have installed SQL Server 2005 Standard Edition... but I am unable to use the database diagram designer. I have tried the right click and the only options I have are refresh and help. Looking at the node, it is an empty folder...

Have I not installed this correctly or am I missing an important step along the way?

Thanks in advance for any info!

Sam

Which version of SQL Server are you running (Can be determined with SELECT @.@.Version)

HTH, Jens Suessmeyer.

-
http://www.sqlserver2005.de
-

database diagrams in SQL 2000 + VS.NET 2005

I've recently upgraded to VS.NET 2005 (still using SQL Server 2000),
and I'm no longer able to edit database diagrams from with VS.NET as I
could with VS.NET 2003. Am I missing a setting somewhere, or is this no
longer
supported?
Thanks,
g.not sure about vs.NET 2005, but I know that you can't edit SQL server
2000 diagrams using sql server 2005 management studio, so I would
assume that VS 2005 has had to make a similar sacrifice in order to
provide the ability to edit the sql 2005 ones.
Cheers
Will|||Thanks. Good thing I kept VS2003 around, I guess!

Database Diagrams from SQL Server

In your experiences, what is the best way to create Database Diagrams?
SQL Server Enterprise Manager Diagrams or Visio?
In SQL Server Enterprise Manager, when I create a "Diagram" and then try to
"Autosize Selected Tables" it leaves a lot of white space at the top which
results in the Table printing over one page. Is there any way to control
this? Does that have something to do with my printer set-up? Even if I
click and drag the table to the top of the page, it automatically slides it
down again creating that white space.
If I Reverse Engineer the Table into Visio, the column attributes are not
showing up.
I welcome your opinions and your help is GREATLY appreciated.
Thanks!
wnfisba
My best way to do this is to use Visio Enterprise Edition (with
reeingineering tool). YOu have a good chance to do your modifications
in here and deploy them right away in the server. Another tool which is
often mentioned is Erwin - a database modelling solution.
HTH, Jens Suessmeyer.
|||When attempting to Reverse Engineer into Visio, I am not seeing the column
attributes. The column names are coming
over, but not their attributes. Can I change that?
Please let me know.
Thanks!
"Jens" wrote:

> My best way to do this is to use Visio Enterprise Edition (with
> reeingineering tool). YOu have a good chance to do your modifications
> in here and deploy them right away in the server. Another tool which is
> often mentioned is Erwin - a database modelling solution.
> HTH, Jens Suessmeyer.
>
|||I also prefer Visio (or Erwin or ERstudio or pretty much
anything) over the Diagram tool in Enterprise Manager.
In terms of the columns in Visio, that's just a setting you
can change. In Visio, open the diagram, go to the menu and
select Database, then Options, then Document. A database
document window pops up. On the tables tab, you can select
what is displayed for the tables in the diagram (which types
of columns, if you want to display data types, etc.).
-Sue
On Thu, 19 Jan 2006 11:50:02 -0800, "wnfisba"
<wnfisba@.discussions.microsoft.com> wrote:

>In your experiences, what is the best way to create Database Diagrams?
>SQL Server Enterprise Manager Diagrams or Visio?
>In SQL Server Enterprise Manager, when I create a "Diagram" and then try to
>"Autosize Selected Tables" it leaves a lot of white space at the top which
>results in the Table printing over one page. Is there any way to control
>this? Does that have something to do with my printer set-up? Even if I
>click and drag the table to the top of the page, it automatically slides it
>down again creating that white space.
>If I Reverse Engineer the Table into Visio, the column attributes are not
>showing up.
>I welcome your opinions and your help is GREATLY appreciated.
>Thanks!
>wnfisba

Database Diagrams export

Hi, Can someone help me?
I need to create a tree structured diagram of our Server databases. I know how to create diagrams via the Enterprise manager, but I don't know how I can export them into some format, that I can further work with (doc., txt.,etc.). Is there some other tool, then the one in enterprise manager?
Thanks in advance.
Magdalena.That may be helpful:

Script SQL Server 2005 diagrams to a file

Database Diagrams -2005 SQL Server Express

I am having the same problem as above. Are there step-by-step instructions available to correct this problem. I have tried some of the solutions listed above and I still can't access the database diagram.

Help

Check this thread out:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120849&SiteID=1

Buck Woody

Database Diagrams -2005 SQL Server Express

I am having the same problem as above. Are there step-by-step instructions available to correct this problem. I have tried some of the solutions listed above and I still can't access the database diagram.

Help

Check this thread out:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=120849&SiteID=1

Buck Woody

Database Diagrams : Showing Relations Column to Column

Hi to all,

As I am going to deal with a huge number of database tables, I thought that drawing their diagrams will be the most professional way of keeping track of what I am doing. So In Enterprise Manager using the Wizard I made it to be drawn nicely.

But I have a problem now. I see that the relations defined among the tables are represented correctly but the line connecting the two table is drawn randomly. I mean the starting point of the line doesnt start from the column having the primary key and doesnt end near to the column having the foreign key. Viewing my diagram I want to see the lines to start and end showing the 2 related key columns.

Is there a way to accomplish this like setting an option, clicking somewhere or should I try to drag the lines to manually?

Thanks in advance

The quick way is to generate the create table statements of the tables and you will see the constraints and if you have constraints you may also check if you have DRI(declarative referential integrity). You can have constraints without DRI so check. Hope this helps.

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
>> > >
>> > >
>> >
>> >
>> >
>>
>
>.
>

Database Diagrams - SQL Server 2005 on Vista

Hi all
I am very new to SQL Server, I am working through my SQL Server 2005 for
beginners book.
I have SQL server 2005 installed on a Win 2003 Server. I have workstation
components installed on my Vista Box.
I am trying to create a database diagram. The DB is basic with just 4
tables. When I click new database diagram I get the message
The specified module could not be found.
(MS Visual Database Tools).
When I go to Advanced information for the error under program location I get
this message
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo)
at
Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn
origUrn, DocumentType editorType, DocumentOptions aeOptions,
IManagedConnection con)
at
Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn
origUrn, DocumentType editorType, DocumentOptions aeOptions,
IManagedConnection con)
at
Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.CreateDesignerWindow(IManagedConnection
mc, DocumentOptions options)
When I connect to the same DB and create a database diagram from a Windows
XP machine all works OK
Any ideas on the problem please.
Thanks in advance
--
David GriffithsWild guess:
Try running Management Studio as a "real" administrator. (I've turned off UAC, and SSMS work just
fine for me. Perhaps you can start an app as a real admin with UAC on somehow...)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"David Griffiths" <dayvg69@.yahoo.nospam.co.uk> wrote in message
news:1MSdnQgixIgX2UXb4p2dnAA@.telenor.com...
> Hi all
> I am very new to SQL Server, I am working through my SQL Server 2005 for beginners book.
> I have SQL server 2005 installed on a Win 2003 Server. I have workstation components installed on
> my Vista Box.
> I am trying to create a database diagram. The DB is basic with just 4 tables. When I click new
> database diagram I get the message
> The specified module could not be found.
> (MS Visual Database Tools).
> When I go to Advanced information for the error under program location I get this message
> at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr
> errorInfo)
> at
> Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn
> origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con)
> at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn
> origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con)
> at
> Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.CreateDesignerWindow(IManagedConnection
> mc, DocumentOptions options)
> When I connect to the same DB and create a database diagram from a Windows XP machine all works OK
> Any ideas on the problem please.
> Thanks in advance
> --
> David Griffiths
>|||Hi
I went the Uninstall SQL 2005 and VS 2005, cleaned up restarted
re-installed.... now it works, that was about 4 hours of work.
Thanks for your reply.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:ADFDF17F-E751-4956-9C9B-EBECF7701BD5@.microsoft.com...
> Wild guess:
> Try running Management Studio as a "real" administrator. (I've turned off
> UAC, and SSMS work just fine for me. Perhaps you can start an app as a
> real admin with UAC on somehow...)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "David Griffiths" <dayvg69@.yahoo.nospam.co.uk> wrote in message
> news:1MSdnQgixIgX2UXb4p2dnAA@.telenor.com...
>> Hi all
>> I am very new to SQL Server, I am working through my SQL Server 2005 for
>> beginners book.
>> I have SQL server 2005 installed on a Win 2003 Server. I have workstation
>> components installed on my Vista Box.
>> I am trying to create a database diagram. The DB is basic with just 4
>> tables. When I click new database diagram I get the message
>> The specified module could not be found.
>> (MS Visual Database Tools).
>> When I go to Advanced information for the error under program location I
>> get this message
>> at
>> System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
>> errorCode, IntPtr errorInfo)
>> at
>> Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn
>> origUrn, DocumentType editorType, DocumentOptions aeOptions,
>> IManagedConnection con)
>> at
>> Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn
>> origUrn, DocumentType editorType, DocumentOptions aeOptions,
>> IManagedConnection con)
>> at
>> Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.CreateDesignerWindow(IManagedConnection
>> mc, DocumentOptions options)
>> When I connect to the same DB and create a database diagram from a
>> Windows XP machine all works OK
>> Any ideas on the problem please.
>> Thanks in advance
>> --
>> David Griffiths
>>
>

Database Diagrams - SQL Server 2005 Express

I have installed Visual Basic 2005 Express and SQL server 2005 Express.

I am reading the ebook: "Microsoft Visual Basic 2005 Express Edition - Build a Program Now" that you download when you register the products (it is a PDF file named 6-2213-2.pdf)

Page 139 of the book (or 151 in the file) is about "To Create Relationships between Tables". So I follow the instruction and get stuck on Step 1. When I right click on the Database Diagrams folder under CarTracker.mdf database and choose Add New Diagram I get the following message:
Microsoft Visual Basic 2005 Express Edition

This database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. Do you want to make yourself the dbo of this database in order to use database diagramming?

Yes No Help
So I click Yes and get the following error


Microsoft Visual Basic 2005 Express Edition

This database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. Ensure the dbo account is valid and ensure you have impersonate permission on the dbo account.

OK Help
I am logged in with an account that is a Domain Admin whilst the laptop is not connected to the network. However, I believe this account is like a Local Administraor (from my NT4 days). In other words, I believe it has all the permissions etc. - I don't know what dbo is. I assume it is Database Owner and if it is, well I created the database.

Any guidance would be greatly appreciated ...

Having the same problem here (WXP SP2, Visual SQL Server Express and Visual C# Express). Anyone care to help us out?

Kind regards,

Maurits

Edited to add:

I too am working on a laptop. I'm at home, so I'm not connected to the university network domain but the user account I'm logged in with is indeed an administrator

|||

Here is one more. Just installed Visual Basic 2005 Express Edition on a XP SP2 laptop. Trying to do exercise on page 139 in the "Build a Program Now" book, about creating relationsship between tables.

"This database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not avaliable. Do you want to make yourself the dbo of this database in order to use database diagraming?"

I then hit the <Yes> button

"This database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not avaliable. Ensure the dbo account is valid and ensure you have impersonate permission on the dbo account."

<OK>

I'm now back to the start again. Shall I create a dbo user account or what?

|||

Here is one more. Just installed Visual Basic 2005 Express Edition on a XP SP2 laptop.

I have the same problem

BR

Alan

|||I had the same problem. My laptop is joined to a domain, and I was working offline. As soon as I connected back to my domain with VPN it starter working again.|||

Brian

Well done. I checked it now that I'm connected to a network domain and I no longer get the error. The diagrams seem to work fine.

Thank you

John

|||

I am also in a domain, but I am connected and still have the problem.

Does this have anything to do with the service account being used? Where can I change the dbo account with SQLExpress?

|||

Regarding service accounts, looking at the service SQL Server (SQLEXPRESS), the Log On tab has:

This account: NT AUTHORITY\NetworkService

[which I never setup or assigned passwords to.]

And looking at the service SQL Server VSS Writer, the Log On tab has:

Local System Account

Please check you have the same settings.

Sorry, I'm not sure if or where you can change dbo account for SQL Express.

|||

I have those same accounts.

I guess the bottom line is...How can I get my account to have impersonate permissions on the dbo account?

Tony Ansley

|||I recently experienced this same problem with the database not having a valid dbo user and being unable to add Database diagrams.

I came to this thread via google and found it to be actually little help since my computer is a stand-alone computer not even connected to the Internet. I am using it for developing the next 'killer app' :)

Anyway - A database connection worked for a while, then it stopped working.

After much fiddling and attempting to recall what I might have broken in the mean time, I realized that between the time that I installed SQL Server Express 2005 and now, I had changed the name of the computer!

I attempted to go into the SQL Server Configuration Tool but couldn't access the server name. Anyway - when I changed the computer name back to the name it had when I did the installation, Everything worked as before - I was able to connect to the databases, create diagrams, and everything!

I hope this helps some of the others of you that are experiencing difficulties.

JosBoy|||

Hi,

I want to give you a little point, to help.

If you create a new Database.mdf you see in the properties one point called "owner". In my case the "owner" was "SHAKIRA\Administrator".

My Computername was HNPC1 and I was logged in (Windows, If you boot your Computer) with this name ("HNPC1\Administrator").

I changed the Computername to SHAKIRA and logged in with this (SHAKIRA\Administrator), and now it was possible to create Diagramms.

God luck

|||I am having the same problem but the solutions posted don't seem to help. Are there step-by-step instructions available|||

The problem is to set up the proper database owner. You should:

-download the free tool from Microsoft site: SQL Server Management Studio Express CTP and install it.

-close the connection to the database (I`m using C# Express Edition, using VB.Net is probably quite the same doing that)

-open the new installed SQL tool

-under "Object Explorer" right click on Databases-"attach"

-find the *.mdf-file and add it

-right click on the new attached database, Properties, "Files", be sure to chose your account as the database owner

-connect to the database using C# Express or what ever

-chose the windows security

that is it.

|||

Thanx AndyWawa,

It pays to go read all the thread before attempting to fix a pro. Your solution was the only one that worked for me

|||

OK, I did that, no change, now what?

My path to this problem was through learning asp.net using the Sussman-Homer book from Wrox. I followed the book through building the db and adding database diagrams and everything worked just fine. Now, trying to teach a little asp in an advanced VB class, it fails (most embarassing for a teacher). The only difference between then and now is adding AJAX. My students (no AJAX) can add database diagrams to their copies.

I downloaded sql server management, installed it, and ran it on my laptop iaw the instructions above only to have the "You do not have permission to impersonate..." messagebox show up as has become maddeningly usual.

Next?