查询结果赋值给变量

夜色镇歌 2012-09-21 12:01:27

declare @newId int

select @newId= top 1.ProjectIntroduce_ID from dbo.MgcWZ_ProjectIntroduce

print @newId



就是查询一列给变量。。 这个是错的 要怎么写啊
...全文
96 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
夜色镇歌 2012-09-21
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

SQL code

--top 1放前面
select top 1 @newId= ProjectIntroduce_ID from dbo.MgcWZ_ProjectIntroduce
[/Quote]

谢谢
人生无悔 2012-09-21
  • 打赏
  • 举报
回复

--top 1放前面
select top 1 @newId= ProjectIntroduce_ID from dbo.MgcWZ_ProjectIntroduce

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧