Solved

Query about SELECT INTO copying table

Posted on 2014-02-06
6
292 Views
Last Modified: 2014-02-06
Hi,
If I copy a table using SELECT * INTO xyz from abc, then would that new table XYZ fetch new rows when old table ABC will be updated?
Or any other method to create a copy and it gets automatically updated?
0
Comment
Question by:fireblues
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 35 total points
ID: 39839090
>would that new table XYZ fetch new rows when old table ABC will be updated?
No.  It's a single action, and once it's complete there is no relationship / connectivity between xyz and abc.

>Or any other method to create a copy and it gets automatically updated?
Explain your needs to us, and we'll propose something.
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 35 total points
ID: 39839097
>Or any other method to create a copy and it gets automatically updated?
You need to create insert/update triggers for this ..
0
 

Author Comment

by:fireblues
ID: 39839145
I have a table ABC. One column in ABC needs to be updated for the purpose of creating report. So I cannot make update on ABC.
ABC is a live table, so it keeps updating.
Can I create a procedure? Can you show me how?
Thanks everyone for your replies.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 65

Expert Comment

by:Jim Horn
ID: 39839176
>One column in ABC needs to be updated for the purpose of creating report.
Spell this out for us, as in most companies updating a production table to reflect anything dealing with reporting is bound to get you some unwanted attention.
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 39839402
Create a separate reporting table, for example "ABC_Report_Data", with the key column(s) from table ABC.  Put your new data column(s) in that table.  You can join to/from ABC using the key column(s).

For example:

CREATE TABLE dbo.ABC (
    key_col int ...,
    data_col1 ...,
    data_col2 ...,
    ...
    )

CREATE TABLE dbo.ABC_Report_Data (
    key_col int ..., --FK --> dbo.ABC ( key_col )
    report_col ...
    )
0
 

Author Comment

by:fireblues
ID: 39841025
Thanks Guys!!! I resolved the problem using several Inner Joins.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Job - date manual 1 46
Sql query with where clause 2 54
SQL Query Across Multiple Tables - Help 5 43
grouping by date only 6 21
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question