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 2000 Forums
 Transact-SQL (2000)
 Table creation and daily update of table

Author  Topic 

sreenu9f
Yak Posting Veteran

73 Posts

Posted - 2008-11-19 : 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.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-11-19 : 15:00:25
If you've got the query to populate this new table, then you can do a SELECT INTO to create it.

SELECT ...
INTO NewTable
FROM <restOfYourQuery>

After that, you'll need to setup a job to run an insert statement:

INSERT INTO NewTable(...)
SELECT ...
FROM <yourQuery>

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

Subscribe to my blog
Go to Top of Page

sreenu9f
Yak Posting Veteran

73 Posts

Posted - 2008-11-19 : 15:07:48
Thanks tkizer; Can u please let me know how to setup a job and run the insert statement on a regular basis.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-11-19 : 15:16:08
Check Books Online for details on how to setup jobs. You can find them under SQL Server Agent in Management Studio (or under Management in Enterprise Manager).

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 -