Solved

Query about SELECT INTO copying table

Posted on 2014-02-06
6
286 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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:ScottPletcher
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now