SQL Server "linked" table

GenesisTech
GenesisTech used Ask the Experts™
on
I have something going on that I have never seen before.

I created a table by using the following code:
SELECT * INTO NEWTable FROM OLDTable

Now, whenever I update a row in either table, it automatically gets updated in the other. Or, if I insert a new row, it gets inserted into the other.

What is happening?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Developer
Commented:
Whatever it is it has nothing to do with the query you created. That query will perform a SELECT INTO one time. After that the two tables are separate entities. The new table will have the same data definition as the old but it will not have the indexes or key constraints that the old table had. There's something else happening.

If you run a simple INSERT statement in SSMS does it come back with a single message:
(1 row(s) affected)
or do you get 2 of those?

Author

Commented:
Thank you. You helped confirm that I was wrong and gave me a way to test in addition to what I was already doing.

As happens many times it technology, I discovered that I had made a typo leading to the issue.

Thanks again for your time and answer!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial