??????????????SET??SELECT??????????????????????????????????????????????Щ??????????????AdventureWorks??????????????

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

????????????????????????????SET????????????????????????????????????????SELECT ???????????????????

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


USE AdventureWorks
GO

-- ???????????SET
DECLARE @Var1ForSet varchar(50)
SET @Var1ForSet = (SELECT [Name] FROM Production.Product WHERE ProductNumber = 'HY-1023-70')
PRINT @Var1ForSet
GO

USE AdventureWorks
GO
-- ???????????SET
DECLARE @Var2ForSet varchar(50)
SET @Var2ForSet = (SELECT [Name] FROM Production.Product WHERE Color = 'Silver')
PRINT @Var2ForSet
GO
 


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

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

????????????????SELECT????????????


USE AdventureWorks
GO

-- ???SELECT ????????
DECLARE @Var1ForSelect varchar(50)
SET @Var1ForSelect = (SELECT [Name] FROM Production.Product WHERE ProductNumber = 'HY-1023-70')
PRINT @Var1ForSelect
GO

--  ???SELECT ????????
DECLARE @Var2ForSelect varchar(50)
SELECT @Var2ForSelect = [Name] FROM Production.Product WHERE Color = 'Silver'
PRINT @Var2ForSelect
GO
 


???????????????г????

?????????????????????????????????????á????SET???????Щ????