在哪里使用getdate + 1 [英] In where how to use getdate + 1

查看:79
本文介绍了在哪里使用getdate + 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的商店程序如下

My store procedure as follows

 set ANSI_NULLS ON
  set QUOTED_IDENTIFIER ON
  GO

  ALTER proc [dbo].[Procdurename] 
  as
  begin

declare @Course varchar(20),
        @CourseDate datetime

       set @CourseDate = getdate();

     select cmn_minor_code as Course_Name,cbm_batch_id as Batch_ID from co_batch_master where cbm_active <> 'D' and cbm_batch_start_dt =



以上条件我想通过coursedate。



我该怎么办。



请帮帮我。



问候,

Narasiman P.


in the above where condition i want to pass the coursedate.

for that how can i do.

please help me.

Regards,
Narasiman P.

推荐答案

看一个例子:

Have a look a example:
CREATE PROCEDURE GetCourseDetails (@cdate DATETIME, @cname varchar(20))
AS
BEGIN
     SELECT cmn_minor_code as Course_Name,cbm_batch_id as Batch_ID
     FROM co_batch_master
     WHERE cbm_active <> 'D' and cbm_batch_start_dt = @cdate AND cmn_minor_code = @cname
END


发布谷歌之前:



添加一天:
Before post google it :

add one day:
select DATEADD(day,1,getdate())



添加一个月:


add one month:

select DATEADD(month,1,getdate())



添加一年:


add one year:

select DATEADD(year,1,getdate())


这篇关于在哪里使用getdate + 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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