Showing posts with label foreign. Show all posts
Showing posts with label foreign. Show all posts

Wednesday, March 7, 2012

Removing foreign keys

Hi everyone,

I've been using VS.NET to design and implement my SQL databases. This has been simple and effective.

I've deployed the database onto the production database server and it's been performing without a hitch for some time now.

My problem is that I now need to remove a foreign key relationship on the production database as I have had a relationship between two tables but now not wanting the relationship since the data that had the relationship is now not wanting to be compulsory. I've had a look in the system.foreignkey (I think) table but I can't make head or tail of it.

Long story short, how can I find and remove the relationship from Query Analyser / Enterprise Manager ? I know how to do this in VS.NET diagram (just delete the relationship) but when you open the production database in VS.NET the diagram is no longer there.

Any help will be appreciated!!

Thanks!
AndrewFixed - was browsing around in VS.NET on the server, right clicked on the table in question, and found the relationship tab, deleted relationship.

Thanks!
Andrew

Saturday, February 25, 2012

Removing clustered index on Primary key.

Hi,
I want to remove clustering of the Primary Key and make a foreign key in the
table the clustered index. Can I do this with a replicated database? I
suppose I hav to do this then on the Publisher and Subscriber database. Does
anybody has any experience with this?
TIA,
Stefan
You have to:
1. exclude this table from publication
2. do the required manipulations of table schema on publisher and
subscribers
3. add table back to publication.
Regards,
Kestutis Adomavicius
Consultant
UAB "Baltic Software Solutions"
"Stefan Gevaert" <stefan.gevaert@.omegasoft.be> wrote in message
news:uA3bA6LZEHA.728@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I want to remove clustering of the Primary Key and make a foreign key in
the
> table the clustered index. Can I do this with a replicated database? I
> suppose I hav to do this then on the Publisher and Subscriber database.
Does
> anybody has any experience with this?
> TIA,
> Stefan
>
|||Stefan,
when I tested this, I found it was possible in merge but not in
transactional replication. Using merge, you should be able to do it directly
on the publisher and using sp_addscriptexec on the subscribers. For
transactional, you'll need to drop then recreate the publication after
making the changes.
HTH,
Paul Ibison
|||I was able to do it by dropping the publication modifying the table and then
replicating it.
Not sure if this is what you want or not.
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:OBMjuFQZEHA.3112@.tk2msftngp13.phx.gbl...
> Stefan,
> when I tested this, I found it was possible in merge but not in
> transactional replication. Using merge, you should be able to do it
directly
> on the publisher and using sp_addscriptexec on the subscribers. For
> transactional, you'll need to drop then recreate the publication after
> making the changes.
> HTH,
> Paul Ibison
>