Hi Im still quite new when using MS SQL but I have a pretty good understanding of it.
-I am using Crystal Reports to retrieve and manipulate data from my database.
-I am creating small tables for certain data.
-This data is selected from a constantly updating table. So i use the WHERE datatime BETWEEN some date AND some date.
Now here is where I think I must use an IF statement or a CASE. The data that I am retrieving can sometimes have errors and thus the system was not operating during this day. So what I want to do is increase the day by 1 each time that shows up.
Can I use an IF statement to determine if a certain value "E" is in a certain row?
IF (SELECT FLOATTABLE.STATUS FROM FLOATTABLE WHERE FLOATTABLE.DATEANDTIME BETWEEN CONVERT(DATETIME, (CONVERT(CHAR(8), GETDATE()-DATEPART(D,CONVERT(DATETIME, (CONVERT(CHAR(8), GETDATE(), 112))))-1, 112)))
AND DATEADD(MINUTE, 10, CONVERT(DATETIME, (CONVERT(CHAR(8), GETDATE()-DATEPART(D,CONVERT(DATETIME, (CONVERT(CHAR(8), GETDATE(), 112))))-1, 112)))) AND tagIndex=26 = 'E')
BEGIN ...code...