Solved

Query about SELECT INTO copying table

Posted on 2014-02-06
6
288 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
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…

840 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