ALTER FUNCTION [dbo].[f_GetCookType]
(
@saleDate datetime
)
RETURNS varchar(6)
AS
BEGIN
declare @cookType varchar(6)
declare @time datetime

Select @time=CONVERT(varchar(100),@saleDate, 24)
if @time>='06:00:00' and @time<='10:00:00' begin
set @cookType='早餐'
end else if @time>='10:00:01' and @time<='14:00:00' begin
set @cookType='午餐'
end else if @time>='14:00:01' and @time<='20:00:00' begin
set @cookType='晚餐'
end else if @time>='20:00:01' and @time<='23:59:59' begin
set @cookType='夜宵'
end

RETURN @cookType
END

mssql函数demo的更多相关文章

  1. 组件嵌套+Mixin函数demo

    非DOM属性:1.dangerouslysetInnerHTML(xxs跨站攻击) 2.key 3.ref 编写组件嵌套 <!DOCTYPE html><html>  < ...

  2. postgresql 函数demo

    create or replace function refresh_product_usage() returns void as $$ declare rec record; sub_rec re ...

  3. scala函数demo

    /** * Created by root * Description : 柯里化函数,偏应用函数,匿名函数,高阶函数 */ object FunctionTest { def main(args: ...

  4. hive日期函数-Demo(二)

    需求:某资产近一个月的资产值 比如:今天是2018年2月28日,近一个月若是按照自然月来算,那么是2018年2月1日至2018年2月28日.最终需要的日期格式为:yyyyMMdd. 当日时间戳 uni ...

  5. mssql游标demo

    declare @billIds varchar(400) declare @billId varchar(40) DECLARE c1 CURSOR FOR select top 5 SaleNo ...

  6. mssql存储过程demo

    ALTER PROCEDURE [dbo].[sp_get_saleData]ASBEGIN set nocount on -- 获取最近上传数据的时间戳 declare @dd datetime s ...

  7. mssql触发器demo

    USE [pos]GO/****** Object: Trigger [dbo].[tr_insert] Script Date: 06/26/2014 09:27:19 ******/SET ANS ...

  8. 字符串分割函数Demo

    #include <stdio.h> int getLength(char *string); int main(int argc, char **argv){ char str[12] ...

  9. oracle建包,函数demo

    create table BOOK ( BOOK_ID NUMBER(10), BOOK_NAME VARCHAR2(10) ); create or replace package chen_pac ...

随机推荐

  1. linux top动态查看进程信息

    来源<鸟哥的linux私房菜> top:动态观察程序的变化 [root@linux ~]# top [-d] | top [-bnp] 参数: -d :后面可以接秒数,就是整个程序画面更新 ...

  2. Java 向Hbase表插入数据异常org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apache.client.HTable

    出错代码如下: //1.create HTablePool HTablePool hp=new HTablePool(con, 1000); //2.get HTable from HTablepoo ...

  3. Razor视图引擎的基本概念与法语

    Razor 视图引擎的特点: 简洁.富于表现.流畅 尽量减少页面代码的输入,实现快速流畅的编程工作 不必明确为服务器代码标记起始与结束符,Razor 能智能判断,这样让页面看清洁,代码方便阅读 asp ...

  4. Javascript学习笔记(一)

    1.form表单中button按钮的事件会导致表单的提交,可以改成<input type='button'  /> 实现 2. 手动触发select的onchange事件 var sele ...

  5. Android tabhost下的activity怎样获取传来的值

    android tabhost下的activity怎样获取传来的值,具体解决方案如下: 解决方案: 其他activity设置intent:Intent intent=new Intent(); int ...

  6. SVN中update to revision与revert to revision的区别

    假设我们有许多个版本,版本号分别是1-10 如果我们在7这里选择revert to this version那么7之后的8,9,10的操作都会被消除 如果在7选择revert changes from ...

  7. 数据关联分析 association analysis (Aprior算法,python代码)

    1基本概念 购物篮事务(market basket transaction),如下表,表中每一行对应一个事务,包含唯一标识TID,和购买的商品集合.本文介绍一种成为关联分析(association a ...

  8. Windows平台下的session0创建进程的问题与解决办法

    很多博客都有记载如何在session0下创建进程的办法,也就是使用CreateProcessAsUser.但是这个要求服务的进程有SE_INCREASE_QUOTA_NAME和SE_ASSIGNPRI ...

  9. poj 1201 Intervals(差分约束)

    题目:http://poj.org/problem?id=1201 题意:给定n组数据,每组有ai,bi,ci,要求在区间[ai,bi]内至少找ci个数, 并使得找的数字组成的数组Z的长度最小. #i ...

  10. hdu 1412 (STL list)

    简单例题 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1412 list 相关博客:http://www.cnblogs.com/fangyukuan/a ...