日期:2014-05-18 浏览次数:20544 次
Declare @Content varchar(1000) set @Content=(Select top 1 Content From db.Table where Content like '%**%') --or Select top 1 @Content=Content From db.Table where Content like '%**%'
------解决方案--------------------
----set赋值不就可以了 Declare @Content varchar set @Content=(Select top 1 Content From db.Table where Content like '%**%')
------解决方案--------------------
select
set
建议用set
------解决方案--------------------
直接set @Content=(Select top 1 Content From db.Table where Content like '%**%')
------解决方案--------------------
这里用set 和select 赋值都可以
------解决方案--------------------
Declare @Content varchar(1000)
set @Content=(Select top 1 Content From db.Table where Content like '%**%')
或者
Select top 1 @Content=Content From db.Table where Content like '%**%'
------解决方案--------------------
楼上都回答完了。
------解决方案--------------------
直接用set或select都可以
------解决方案--------------------
--方法一
DECLARE @Name VARCHAR(50);
SELECT TOP 1 @Name=Name FROM dbo.DataDictional
PRINT @Name
--方法二
SELECT @Name=(SELECT TOP 1 Name FROM dbo.DataDictional)
PRINT @Name
--方法三
SELECT @Name=Name FROM (SELECT TOP 1 Name FROM dbo.DataDictional) AS t
PRINT @Name