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)
 Problem Creating Views in Stored Procedure

Author  Topic 

harissarwar
Starting Member

15 Posts

Posted - 2008-07-01 : 00:28:59
I am unable to create views in stored procedure. Can any one help how to create a temporary view in a procedure.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-01 : 00:37:28
temporary view ? Don't think you can do that.

What are you want to achieve with it ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-01 : 01:15:32
quote:
Originally posted by harissarwar

I am unable to create views in stored procedure. Can any one help how to create a temporary view in a procedure.


I think what you need is a temporary table not a temporary view.Can you explain your scenario please?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-01 : 01:17:54
"I think what you need is a temporary table not a temporary view"
OK. that make more sense


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

harissarwar
Starting Member

15 Posts

Posted - 2008-07-01 : 04:13:47
I just want to have the results of two queries avilable for further processing.
If i cant't create view how can i create a table from a query.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-01 : 04:43:16
"I just want to have the results of two queries avilable for further processing."
use temp table

create table #temp_table
(
< col list >
)


"If i cant't create view how can i create a table from a query."
You can create a view but not temporary view as there isn't such thing as a temporary view.



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

harissarwar
Starting Member

15 Posts

Posted - 2008-07-01 : 04:56:49
Can't i create a table as a result of query as in views.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-01 : 04:58:01
quote:
Originally posted by harissarwar

Can't i create a table as a result of query as in views.




What do you mean ? Don't really understand the statement. Can you post your query ? And explain what are you trying to do ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

harissarwar
Starting Member

15 Posts

Posted - 2008-07-01 : 08:16:38
Create View V1 as (Query comes here)
In view you don't have to specify all the columns and the data to copy.
While in
Creating table i have to specify all the columns. And even have to copy data as well, i think so.
I dont' want to do that.

Basically i need to use result of query three or four times in my stored procedure.
Is there any other to achive this?
Go to Top of Page
   

- Advertisement -