pauledward123
Technical User
- Nov 15, 2011
- 2
Hello
Just starting with SQL and i'm experimenting with creating a temporary table and storing variables. I'm trying th efollowing code but I get an error "Invalid object name 'Temptable'."
Here's the code:
Just starting with SQL and i'm experimenting with creating a temporary table and storing variables. I'm trying th efollowing code but I get an error "Invalid object name 'Temptable'."
Here's the code:
Code:
WITH Temptable AS
(
SELECT ID_prom, Name_prom
FROM TSSITE_Prominences_prom
)
select top 1 ID_prom, Name_prom from Temptable
declare @b int, @c varchar(20)
select
@b = ID_prom, @c = Name_prom
from Temptable