-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
Alter PROCEDURE sp_get_in_data
-- Add the parameters for the stored procedure here
@billno varchar(20) = ''
AS
declare @sql varchar(8000),@i int
BEGIN
set @i=0;
set @sql=' select pro_id as 货号,pro_name as 名称 ' ;
select @i=@i+1,-- 有多少行,@i就增加几次.
@sql=@sql+' ,sum(case style when '''+ style_var +'''then qty else 0 end)as '''+style_var+''' '
from (
select distinct name as style_var from t001 -- 模本表
) tem;
set @sql=@sql+' from t002 where billno = '''+@billno+''' group by pro_id,pro_name'
-- 执行动态SQL语句.
exec(@sql)
END
GO
SQL创建存储过程[横向显示列的数据]
5星 · 超过95%的资源 需积分: 16 10 浏览量
2008-05-13
12:12:00
上传
评论
收藏 2KB RAR 举报
流浪Earth
- 粉丝: 3
- 资源: 10
最新资源
- 基于Qt及OpenCv设计了一个视觉检测系统,实现了米粒的计数、缺陷分析功能+源码+文档说明+效果图
- 基于STM32F1和TB6612芯片的电机驱动板,可以驱动两个电机正反转,具有比L298N更小的体积源码+文档说明
- 基于Javascript的CNN卷积交互式播放器设计源码
- 基于Layui的树表格(treeGrid)前端设计源码
- 基于Vue框架的Node+Vue茶叶商城设计源码
- 基于HTML的响应式网站设计源码
- 基于Python的CNN医学图像分割设计源码
- jjcbbdnfiapchhkemifphepfgilhdokf_4.5.6_chrome.zzzmh.cn.crx
- Screenshot_20240418_234552.jpg
- Screenshot_20240418_234558.jpg
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈