HestonJames
Programmer
Guys,
I'm sure this is a simple enough question but I'm unable to solve it, I'm obviously using something wrong:
throws an exception saying:
Msg 137, Level 15, State 2, Line 14
Must declare the scalar variable "@MessageStaging".
When looking through a few tutorials on using these in memory table variables I see a couple of mentions of this error being thrown but real explanation of why.
Can someone give this beginner a kick in the right direction ? ;-)
Cheers all,
Heston
I'm sure this is a simple enough question but I'm unable to solve it, I'm obviously using something wrong:
Code:
DECLARE @MessageStaging TABLE (
DeviceAddress char(17) Collate Database_Default,
PushPort smallint ,
LogDateTime datetime,
LogClass varchar(50) Collate Database_Default,
Media_ID int,
Campaign_ID int
)
INSERT
INTO OUI
( OUI
, Manufacturer )
SELECT DISTINCT LEFT(@MessageStaging.DeviceAddress, 8)
, 'Unknown OUI, ' + CONVERT(VARCHAR(25), GETDATE(), 121)
FROM @MessageStaging
LEFT OUTER
JOIN OUI
ON OUI.OUI = LEFT(@MessageStaging.DeviceAddress, 8)
WHERE OUI.OUI IS NULL
throws an exception saying:
Msg 137, Level 15, State 2, Line 14
Must declare the scalar variable "@MessageStaging".
When looking through a few tutorials on using these in memory table variables I see a couple of mentions of this error being thrown but real explanation of why.
Can someone give this beginner a kick in the right direction ? ;-)
Cheers all,
Heston