Hi,
I am trying the following t-sql code in the pubs database:

begin
declare @tvar Table
(
job_id smallint,
job_desc varchar(50),
min_lvl tinyint,
max_lvl tinyint
)

insert into @tvar
select * from jobs

exec sp_executesql N'select * from @tvarname order by @ord',N'@tvarname TABLE, @ord varchar(50)',@tvar,'job_id desc'
end

It gives me an error:
Server: Msg 137, Level 15, State 2, Line 13
Must declare the variable '@tvar'.


Any ideas how to get resolve this?

thx in advance
--tabs