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.
| Author |
Topic |
|
trouble2
Constraint Violating Yak Guru
267 Posts |
Posted - 2008-08-11 : 06:18:38
|
| Hi, I have a table where a lot of items get logged, and I want to build a SP which checks for a certain month and year if it has items or not. Until now I have this, but it does not work yet:ALTER procedure [dbo].[CheckIfLogExists]@Month int,@Year int,@exists bit outputasSet @exists = falseif exists( select LogID From LogTable where MONTH(LogDate) = @Month AND YEAR(LogDate) = @Year )set @exists=truereturn @Existscan anyone tell what I should do? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-11 : 06:24:19
|
quote: Originally posted by trouble2 Hi, I have a table where a lot of items get logged, and I want to build a SP which checks for a certain month and year if it has items or not. Until now I have this, but it does not work yet:ALTER procedure [dbo].[CheckIfLogExists]@Month int,@Year int,@exists bit outputasSet @exists = falseif exists( select LogID From LogTable where MONTH(LogDate) = @Month AND YEAR(LogDate) = @Year )set @exists=true 1return @Existscan anyone tell what I should do?
|
 |
|
|
trouble2
Constraint Violating Yak Guru
267 Posts |
Posted - 2008-08-11 : 06:41:37
|
| Thanks |
 |
|
|
|
|
|