?????????????????????

??????????????????????????SELECT ?????????л???????????????????????????????ζ?дSET???????????????????


USE AdventureWorks
GO

-- ?????
DECLARE @var1 VARCHAR(50)
DECLARE @var2 VARCHAR(50)
DECLARE @var3 VARCHAR(50)

SELECT @var1 = 'Value1'?? @var2 = 'Value2'?? @var3 = 'Value3'
PRINT @var1
PRINT @var2
PRINT @var3
GO

-- ????????????
DECLARE @name VARCHAR(50)
DECLARE @productNo VARCHAR(25)
DECLARE @color VARCHAR(15)

SELECT @name = [Name]?? @productNo = ProductNumber?? @color = Color
FROM Production.Product
WHERE ProductID = 320
PRINT @name
PRINT @productNo
PRINT @color
GO
 


???????????????

?????????????SET???????????????????????????


USE AdventureWorks
GO

-- ?????
DECLARE @var1 VARCHAR(50)
DECLARE @var2 VARCHAR(50)
DECLARE @var3 VARCHAR(50)
SET @var1 = 'Value1'
SET @var2 = 'Value2'
SET @var3 = 'Value3'
PRINT @var1
PRINT @var2
PRINT @var3
GO

-- ???????????
DECLARE @name VARCHAR(50)
DECLARE @productNo VARCHAR(25)
DECLARE @color VARCHAR(15)
SET @name =(SELECT [Name] FROM Production.Product WHERE ProductID = 320)
SET @productNo = (SELECT ProductNumber FROM Production.Product WHERE ProductID = 320)
SET @color = (SELECT Color FROM Production.Product WHERE ProductID = 320)
PRINT @name
PRINT @productNo
PRINT @color
GO
 


????????????

????????????????????SELECT ?????????????????????????Ч??????????????