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
 General SQL Server Forums
 New to SQL Server Programming
 Insert from a view

Author  Topic 

Sep410
Posting Yak Master

117 Posts

Posted - 2008-05-22 : 13:07:17
Hi,

I need to write a stored procedure which can insert into a table some records and these records are results of a view.
Can anyone tell me what should I do?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-22 : 13:19:05
INSERT INTO Table1 (...)
SELECT ...
FROM View1
WHERE ...

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

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

Sep410
Posting Yak Master

117 Posts

Posted - 2008-05-22 : 13:27:25
Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-22 : 14:30:16
A view nothing but a virtual table so you can use it in same way as table in queries.
Go to Top of Page
   

- Advertisement -