INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

modifying a field

modifying a field

(OP)
In SQL Server 2008 R2 I changed the data type of a field and when I clicked Yes to change that field a message box appeared stating:

"The following tables will be saved to your database. Do you want to continue?"

It listed the table I changed plus another table I did not touch. I chose No and confirmed this field does not exist in the other table. Why is this happening and how can I prevent the other table from appearing? For all I know that other table did not change in any way and I tried it a couple times.

RE: modifying a field

As Frederico stated it might be part of a FK relation. And the columns don't have to have the same name.

Let's say I have a table (myTable) with the column myCol. myCol is CHAR(10), but I need to change it to VARCHAR(100). THe table has a FK with myTable2 on the column thisColumn which is CHAR(10). The name isn't the same, but the same data is kept in it. I need to change both columns at the same time. This is probably what is happening to you.

Here is a script to run on the database to find all the FKs that exist.
(I can't take credit for the code, I forget where I got it from).

CODE

SELECT f.name AS ForeignKey,
OBJECT_NAME(f.parent_object_id) AS TableName,
COL_NAME(fc.parent_object_id,
fc.parent_column_id) AS ColumnName,
OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName,
COL_NAME(fc.referenced_object_id,
fc.referenced_column_id) AS ReferenceColumnName
FROM sys.foreign_keys AS f
INNER JOIN sys.foreign_key_columns AS fc
ON f.OBJECT_ID = fc.constraint_object_id 

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875: What should I know before I post?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close