• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
百里丶落云
Gee,gee,baby,baby
            管理     
sql server 变量和select 赋值的联合使用demo
DECLARE @cltcode VARCHAR(30)

DECLARE @brand VARCHAR(30)

select @cltcode=cltcode,@brand=brand from prosamplehd 

CREATE table #t (

cltcode VARCHAR(30),
brand VARCHAR(30)




)

INSERT into #t  (cltcode ,brand) VALUES (@cltcode ,@brand)
select *from #t

 

 

 

 

解释:

DECLARE  定义变量后 

创建临时表,然后insert into 中插入变量的返回值, 

 

年与时驰,意与日去,遂成枯落, 多不接世,悲守穷庐,将复何及。
posted on 2019-07-11 11:40  百里丶落云  阅读(659)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3