Solved

Query about SELECT INTO copying table

Posted on 2014-02-06
6
287 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
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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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