sql function and store process:

create function  [dbo].[fun_splitin](@c varchar(),@split varchar())
returns @t table(col varchar())
as
begin
while(charindex(@split,@c)<>)
begin
insert @t(col)values (substring(@c,,charindex(@split,@c)-))
set @c=stuff(@c,,charindex(@split,@c),'')
end
insert @t(col)values(@c)
return
end
create procedure [dbo].[sp_getallstaticgoodlocationdata]
@platoon varchar()
as
begin
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[t_getstaticgoodlocationdata_temp]') and OBJECTPROPERTY(id, N'IsUserTable') = )
drop table [dbo].[t_getstaticgoodlocationdata_temp]
create table [t_getstaticgoodlocationdata_temp](id numeric() identity(,) primary key , the_floor int,the_column1 int,the_column2 int,the_column3 int,the_column4 int,the_column5 int,the_column6 int,the_column7 int,the_column8 int,the_column9 int,the_column10 int,the_column11 int,the_column12 int
,the_column13 int,the_column14 int,the_column15 int,the_column16 int,the_column17 int,the_column18 int,the_column19 int,the_column20 int,the_column21 int,the_column22 int,the_column23 int,the_column24 int,the_column25 int,the_column26 int,the_column27 int,the_column28 int,the_column29 int,the_column30 int,
the_column31 int,the_column32 int,the_column33 int,the_column34 int,the_column35 int,the_column36 int,the_column37 int,the_column38 int
,the_column39 int,the_column40 int) DECLARE @the_platoon int
DECLARE cursor_name CURSOR FOR
select distinct F_Platoon from Sys_GoodLocation where F_Status= and F_Locked='N' and F_Platoon in ((select col from dbo.fun_splitin(@platoon,',')) )
OPEN cursor_name
FETCH NEXT FROM cursor_name INTO @the_platoon
WHILE @@FETCH_STATUS =
BEGIN
if @the_platoon<>
begin
insert into [dbo].[t_getstaticgoodlocationdata_temp](the_floor,the_column1,the_column2,the_column3,the_column4,the_column5,the_column6,the_column7,the_column8,the_column9,the_column10,the_column11,the_column12
,the_column13,the_column14,the_column15,the_column16,the_column17,the_column18,the_column19,the_column20,the_column21,the_column22,the_column23,the_column24,the_column25,the_column26,the_column27,the_column28,the_column29,the_column30,
the_column31,the_column32,the_column33,the_column34,the_column35,the_column36,the_column37) exec sp_getgoodlocationviaplatoon @the_platoon
end
FETCH NEXT FROM cursor_name INTO @the_platoon
END
CLOSE cursor_name
DEALLOCATE cursor_name select the_floor,convert(int,isnull(SUBSTRING(convert(varchar(),the_column1),,),)) as the_platoon,the_column1,the_column2,the_column3,the_column4,the_column5,the_column6,the_column7,the_column8,the_column9,the_column10,the_column11,the_column12
,the_column13,the_column14,the_column15,the_column16,the_column17,the_column18,the_column19,the_column20,the_column21,the_column22,the_column23,the_column24,the_column25,the_column26,the_column27,the_column28,the_column29,the_column30,
the_column31,the_column32,the_column33,the_column34,the_column35,the_column36,the_column37 from [dbo].[t_getstaticgoodlocationdata_temp]
end

call:

exec [dbo].[sp_getallstaticgoodlocationdata] '1,2,3,6'

result:

Get all static wms goodlocation data的更多相关文章

  1. Init wms goodlocation data

    insert goodlocation: CREATE PROCEDURE [dbo].[sp_insert_goodlocation] -- Add the parameters for the s ...

  2. .NET并行计算和并发4-Thread-Relative Static Fields and Data Slots

    Thread Local Storage: Thread-Relative Static Fields and Data Slots 文章摘自msdn library官方文档 可以使用托管线程本地存储 ...

  3. C++ essentials 之 static 关键字

    extraction from The C++ Programming Language, 4th. edition, Bjarne Stroustrup If no initializer is s ...

  4. Competing in a data science contest without reading the data

    Competing in a data science contest without reading the data Machine learning competitions have beco ...

  5. 代码中函数、变量、常量 / bss段、data段、text段 /sct文件、.map文件的关系[实例分析arm代码(mdk)]

    函数代码://demo.c #include<stdio.h> #include<stdlib.h> , global2 = , global3 = ; void functi ...

  6. Spring data mongodb 聚合,投射,内嵌数组文档分页.

    尽量别直接用 DBObject  ,Spring data mongodb 的api 本来就没什么多大用处,如果还直接用 DBObject 那么还需要自己去解析结果,说动做个对象映射,累不累 Spri ...

  7. 【很变态】PHP类实例化对象竟然可以访问类的“静态(static)方法”!!!

    之前发现一个PHP的变态问题:PHP中静态(static)调用非静态方法详解 这次看了下 ThinkPHP 的源码 function.inc.php ,里面有个函数: /** * 取得对象实例 支持调 ...

  8. [Spring Data MongoDB]学习笔记--MongoTemplate查询操作

    查询操作主要用到两个类:Query, Criteria 所有的find方法都需要一个query的object. 1. 直接通过json来查找,不过这种方式在代码中是不推荐的. BasicQuery q ...

  9. [Spring Data MongoDB]学习笔记--MongoTemplate插入修改操作

    插入操作: 直接给个例子 import static org.springframework.data.mongodb.core.query.Criteria.where; import static ...

随机推荐

  1. ES6-Promise.all()使用

    Promise.add 方法:将多个 promise 实例,包装成一个新的 promise 实例. const p = Promise.all([p1, p2, p3]); 接受一个数组作为参数,p1 ...

  2. $a=[1,2,3,4,5]; $b=[a,b,c,d,e]; 转成[[1,a],[2,b],[3,c],[4,d],[5,3]]

    $a=[1,2,3,4,5]; $b=[a,b,c,d,e]; 结果 [[1,a],[2,b],[3,c],[4,d],[5,3]] return array_map(function($v1,$v2 ...

  3. Concept of function continuity in topology

    Understanding of continuity definition in topology When we learn calculus in university as freshmen, ...

  4. rem实现移动端自适应页面

    一.把px转换成rem方案 1.cssrem插件 2.css预处理器 3.rem-unit插件 4.px2rem插件 rem就是相对于根元素的font-size来做计算,设置好根结点字体大小,子节点用 ...

  5. SpringCloud教程 | 第五篇: 路由网关(zuul)(Finchley版本)

    在微服务架构中,需要几个基础的服务治理组件,包括服务注册与发现.服务消费.负载均衡.断路器.智能路由.配置管理等,由这几个基础组件相互协作,共同组建了一个简单的微服务系统.一个简答的微服务系统如下图: ...

  6. C# - 什么是事件绑定?

    今天在学习C#时碰到了一个新词:“绑定事件”,不知道是什么东西? 请各位C#前辈指点!!!

  7. css 背景(background)属性、背景图定位

    background属性: Background属性是css中应用比较多,且比较重要的一个属性,它是负责给盒子设置背景图上和背景颜色的,background是一个复合属性,它可以分解成如下几个设置项: ...

  8. day9面向对象,多线程2

    一.获取全部qq成员头像 import os,requests,pymongo class Qqgroup(object):#定义一个类 #定义获取QQ群的请求rul,抓包获取 group_rul = ...

  9. wangEditor大图片上传问题

    wangEditor上传大图片时候会 上传超时.后端没有问题,我百度很多,又去群里问,都得不到答案.最后问同事,有个属性  editor.config.uploadTimeout = 10000000 ...

  10. (78)Wangdao.com第十五天_JavaScript 面向对象

    面向对象编程(Object Oriented Programming,缩写为 OOP) 是目前主流的编程范式. 是单个实物的抽象, 是一个容器,封装了属性(property)和方法(method),属 ...