Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Need help to write stored procedure

Author  Topic 

Mazdak
Yak Posting Veteran

63 Posts

Posted - 2002-10-23 : 02:44:29
Could someonehelp me to write this stored procedure?

I have two datetime column and ID column(its integer).I pass an ID to stored procedure and want to check if today is between these two date,and return true or false.

Thanks

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2002-10-23 : 04:34:37
T-sql does not support a boolean type, so you have to use something else.


create procedure Mazdak(@id int)
as
if exists(select 1 from t where id = @id and datetime1 between current_timestamp and datetime2 )
return 1
else
return 0

Go to Top of Page
   

- Advertisement -