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 2005 Forums
 Transact-SQL (2005)
 Help on View Creation

Author  Topic 

chetan_dba
Starting Member

21 Posts

Posted - 2008-03-27 : 02:04:37
Hi,
Currently i have one store procedure which is used to report generation. It creats some temporary tables ( # tables), and also uses while loop.

Now i wanted to create a view for the same functionality due to client requirment.

Now when i changed the code, it tells me that u cannot create a view with # tables. With the following Error :
"" Views or functions are not allowed on temporary tables. Table names that begin with '#' denote temporary tables""

Any thoughts...


Thanks in advance.
-- Chetan

nr
SQLTeam MVY

12543 Posts

Posted - 2008-03-27 : 02:36:58
Well you can't use temp tables.
You'll need to find a way to do it in a single statement - maybe using CTEs or functions or derived tables.
Or maybe call the sp to populate a table then have the client access that table.

Better would be to get a client that can accept stored procedure output otherwise it's very limiting.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -