I have a simple procedure that uses two identical virtual tables:
declare @t table
(T datetime, Berth5 int, BerthOther int)
declare @t2 table
(T datetime, Berth5 int, BerthOther int)
Now after populating those tables I can select from any of those i.e. SELECT * FROM @t but I can't select from join
SELECT * FROM @t inner join @t2 on @t.T=@t2.T
or
SELECT * from [@t] inner join [@t2] on [@t].T= [@t2].T
I receive Must declare the scalar variable "@t"/@t2 (in second example its "Invalid object name '@t') "
EDIT: select * from @t t inner join @t2 t2 on t.T= t2.T Works fine
Aucun commentaire:
Enregistrer un commentaire