560 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Speed comparison of temporary tables against table variables
Part three of a five-part series of blogs
When you are programming in SQL, you often have the choice of using table variables or temporary tables. This blog considers whether one method is substantially quicker than the other (spoiler alert: not really).
Here's the code to generate our temporary table and view its results:
-- get rid of any old table
DROP TABLE IF EXISTS #AdviceRows
-- create a new one
CREATE TABLE #AdviceRows (
-- the number of rows to generate
DECLARE @max int = 100000
-- loop counter used and string variable
DECLARE @i int = 1
DECLARE @s varchar(100)
-- keep going till we've created enough rows
WHILE @i <=>=>
-- text to store
SET @s =
WHEN @i % 3 = 0 THEN 'This too shall pass'
WHEN @i % 3 = 1 THEN 'Look before you leap'
ELSE 'Fortune favours the brave'
INSERT INTO #AdviceRows (ID,OwlyAdvice)
SET @i = @i + 1
a.OwlyAdvice AS Advice,
COUNT(*) AS Frequency
#AdviceRows AS a
Next up, table variables.
|Parts of this blog|
25 Aytoun Street