Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 create a new table and update frequently

Author  Topic 

sreenu9f
Yak Posting Veteran

73 Posts

Posted - 2008-11-19 : 14:24:28
Posted - 11/19/2008 : 14:22:38
--------------------------------------------------------------------------------

I am new to the sql world ( i do write the queries and some stored procedures). The challange that i have currently is i need to create a table based on values coming from several other tables and this one table should be updated on a daily basis.
I started with writing a query to accumulate all the data needed for this table from different tables by joininig appropriate tables but how can i create a new table and update this on a daily basis?

How can this be accomplished. please provide the suggestions.

Thanks in advance for everyone.

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-11-19 : 14:35:58
Once you have the select statement ready after joining all tables, You could use INTO keyword to create a table of the same structure. Something like,

Select a.Emp,b.EmpName into NewTable from EmpTable a join EmpDetails b on a.id=b.id where 1=2


You could then perform inserts and updates accordingly.
Go to Top of Page

sreenu9f
Yak Posting Veteran

73 Posts

Posted - 2008-11-19 : 14:42:11
Thanks sakets_2000; How can i update this newly created table on daily basis.
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-11-19 : 14:47:21
quote:
Originally posted by sreenu9f

Thanks sakets_2000; How can i update this newly created table on daily basis.



NP.
If you can post your select query, some sample data and the kind of update you want to run on a daily basis, It'll be easier to explain.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-11-19 : 15:00:46
Duplicate, locking thread.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -