4

一時テーブルから行を削除できないのはなぜですか?

DECLARE @tbl2 TABLE
    (
    Id int,
    ImieNazwisko varchar(200),
    Pesel varchar(200),
    Kod varchar(200)
    )

DELETE FROM @tbl2 tblT WHERE tblT
SELECT * FROM @tbl2

また、これは機能しません:

DELETE FROM @tbl2 WHERE @tbl2.Id
4

4 に答える 4

10

一時テーブルから削除できます。それはあなたの構文が間違っているようです。

これを試して:

--drop table #temptable 
create table #temptable (Id int)
insert into #temptable 
select 1 union
select 2 union 
select 3 

delete from #temptable 
where Id =2

select Id from #temptable 
于 2013-05-09T08:47:54.670 に答える
0
drop table if exists Locations;
Create temporary table Locations
SELECT au_lname, au_fname, 
CASE 
WHEN state = "CA" or state = "AZ" THEN "west side"
WHEN state = "UT" or state = "MI" or state = "TN" THEN "mid US"
ELSE "east side"
END AS LocationInTheUS 
FROM authors
order by LocationInTheUS desc;
delete from Locations where au_lname = " ";
select * from Locations;
于 2019-10-29T04:49:12.793 に答える