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 |
obezyanka
Starting Member
24 Posts |
Posted - 2007-09-24 : 13:39:21
|
How can I create a stored procedure that combines the results from three views, and puts them in a temp table? |
|
Zoroaster
Aged Yak Warrior
702 Posts |
Posted - 2007-09-24 : 13:50:33
|
Need the DDL for the views. Basically once you have the results you want in a query you will need to SELECT INTO to load then into a temp table. Future guru in the making. |
|
|
obezyanka
Starting Member
24 Posts |
Posted - 2007-09-24 : 13:56:42
|
this is my stored procedure:--------------------CREATE PROCEDURE [dbo].[test] ASinsert INTO TempTable (...)SELECT ...FROM viewGO--------------------I don't get error messages but it doesn't creat the table I need and doesn't insert anything. What's wrong with this procedure? |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-09-24 : 23:02:11
|
If the table doesn't exist, should use 'select ... to TempTable from view ...'. |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2007-09-25 : 10:01:44
|
--create the #temp tableSELECT Column1, Column2, Column3, INTO #temp1FROM myViewJack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com/SQL |
|
|
obezyanka
Starting Member
24 Posts |
Posted - 2007-09-25 : 10:25:25
|
I got the error:Incorrect syntax near the keyword 'INTO'. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|