获取当前日期作为存储过程的一部分 [英] Getting current date as part of an Stored Procedure

查看:42
本文介绍了获取当前日期作为存储过程的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下SP:

I have the following SP:

展开 | 选择 | Wrap | 行号

推荐答案

我是不确定你想要什么,因为你已经在使用getdate,它会返回当前的日期和时间。
I''m not sure what you want because you''re already using getdate which will return the current date and time.


Rabbit,


它''没有产生任何结果。例如,如果我单独按日期运行此查询,那么它将工作。但是因为我的日程安排有开始时间和结束时间,而我正在寻找的是BETWEEN声明,但我不知道是什么。这将是午夜和更新之间的事情...我只是不知道如何写它。


例如...当我单独使用日期运行时......这就是我得到的:


SETON NW - 2011-08-12 19:00:00.000 2011-08-13 07:00:00.000

HEART HOSPITAL - 2011-08-12 07:00:00.000 2011-08-12 13:00: 00.000

SETON MAIN - 2011-08-12 07:00:00.000 2011-08-12 17:00:00.000

SETON MAIN - 2011-08-12 17: 00:00.000 2011-08-12 23:00:00.000


您可以看到它显示当前时间之前和当前时间之后的两个值。我需要做的是查看当前时间但不迟到。
Rabbit,

It''s not producing any results. For example, if I run this query by date alone, then it''ll work . But because my schedules have start times and end times and what I''m looking to do is something with a BETWEEN statement, but I just don''t know what. It would be something like between midnight and getdate ... I just don''t know how to write it.

For example ... when I run this with date alone ... here''s what I get:

SETON NW - 2011-08-12 19:00:00.000 2011-08-13 07:00:00.000
HEART HOSPITAL - 2011-08-12 07:00:00.000 2011-08-12 13:00:00.000
SETON MAIN - 2011-08-12 07:00:00.000 2011-08-12 17:00:00.000
SETON MAIN - 2011-08-12 17:00:00.000 2011-08-12 23:00:00.000


and you can see that it shows me both values before the current time and after the current time. What I need to be able to do is to see up to the current time but no later.


展开 | 选择 | 换行 | 行号


这篇关于获取当前日期作为存储过程的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆