java - Invalid object name of a temp table -


i'm salvaging java code left me previous employee, left source code itself, i've had recreate db structure myself. far restored it, 1 line throws exceptions @ me , can't understand why.

connbeztirazh.execsqlu("declare @ki table (id_ki int); " + "declare @bil table (id_bilet int); " + "insert ki (i1,i2,i3,i4,i5,i6) output inserted.id_ki @ki values ("+i1+","+i2+","+i3+","+i4+","+i5+","+i6+"); " + "insert bilet(id_ki,data) output inserted.id_bilet @bil values ((select id_ki @ki),(select sysdatetime())); " + "insert rezultat (id_players, id_bilet) output inserted.id_bilet values ((select id_players players telnomer='"+number+"'),(select id_bilet @bil));", false); 

this line throws out following exception:

com.microsoft.sqlserver.jdbc.sqlserverexception: invalid object name 'ki'. 

i triple-checked everything, recreated tables bilet, players , rezultat, used elsewhere in code , everything's alright. far understand sql, ki , bil temporary tables , since created , accessed in same query there not access/session problems.

in case, overlooked in fact there 2 tables: constant table ki , variable table ki. referenced ki , @ki respectively, bad way name tables. after adding table ki database, started working intended, far can tell.

thanks commented on post.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -