Reputation: 831
I have something like:
DECLARE @tbl TABLE
(
name varchar(255),
type int
)
UPDATE c
SET c.name = t.name
FROM dbo.cars c
JOIN @tbl t ON t.type = c.type
I have a stored procedure that does something similar but it takes over 20 minutes with the table variable. It runs in less than 2 minutes if I change it from table variable to temp table. Why is this so?
Upvotes: 1
Views: 1932
Reputation: 11
I think this answer helpfull for you
https://stackoverflow.com/a/64891/1887827
I recommend that you look at this link;
https://support.microsoft.com/en-gb/kb/305977
Upvotes: 1