June 1, 2007 at 1:03 am
Hi,
If I have a temporarily table and table variable table like
create table #a1(cno int, desc char(10))
declare @b1 table(cno int, desc char(10))
create table #c1(cno int, desc char(10))
add data into these 2 table
insert #a1
value(1,'testing1')
insert @b1
value(1,'testing1')
However, when I update the table variable, it will give error.
(this update is okay)
Update #a1
set desc = 'testing2'
from #c1 a
where #a1.cno = a.cno
(this update is giving problem)
Update @b1
set desc = 'testing3'
from #c1 a
where @b1.cno = a.cno
How do I solve above issue if I am using table variable instead.
Thank you
June 1, 2007 at 2:11 am
I assume you're getting a syntax error (you didn't say what the problem was ) on the update statement.
Try
Update b
Set desc = 'testing3'
from @b-2 b
inner join #c1 a
on b.cno = a.cno
Otto Schreibke
The future is a foreign country, they do things differently there.
(Stolen from Arthur C Clarke)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply