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.
Author |
Topic |
Patyk
Yak Posting Veteran
74 Posts |
Posted - 2014-02-17 : 15:00:39
|
I am looking for an example of a store procedure that will run a existing view and copy the results to a table. Every time it runs the table needs to be truncated. Will run once a day.My view is a followsSELECT PClassFROM mydatabase.dbo.ProductClassDesWHERE (ProductClass <> '_RBS') AND (ProductClass <> '_EDT') AND (ProductClass <> '_BMS') AND (ProductClass <> '_PAZ') AND (ProductClass <> '_PBC') View results need to be copied to a table tblCurrentProductClasses that will only contain one field PClass.Any help appreciated.Thanks |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2014-02-17 : 15:16:21
|
[code]create procedure myProcedure asbegin truncate table tblCurrentProductClasses insert into tblCurrentProductClasses (PClass) select PClass from myViewendgo[/code]Be One with the OptimizerTG |
|
|
Patyk
Yak Posting Veteran
74 Posts |
Posted - 2014-02-17 : 16:01:34
|
thanks it works |
|
|
|
|
|