DECLARE device_ip nvarchar 50 SELECT device_ip Hostname FROM TestDB db

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
DECLARE @device_ip nvarchar(50)
SELECT @device_ip = Hostname FROM [TestDB].[dbo].[Sources]
WHERE ID =
(
SELECT SourceId FROM [TestDB].[dbo].[Channels]
WHERE TAG =
(
SELECT TOP(1) PARAM2
FROM inserted
)
)