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 2008 Forums
 Transact-SQL (2008)
 Access Date to SQL Date HELP

Author  Topic 

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-03-23 : 11:58:57
The date portion is confusing me and the = 2 as well. I'm trying to convert this to SQL but now luck. For the first INSTR line i can just use LIKE.


((IIf(InStr([tableA].[Name],"SomeName")<>0
And [TableA].[DateOf]<date(),1,2))=2))


RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2011-03-23 : 13:20:40
I would say the logic is:

AND (CASE WHEN [TableA].[DateOf] < GETDATE() THEN 1 ELSE 2 END) = 2 )
Go to Top of Page

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-03-24 : 09:57:17
I think this:
<date(),1,2))=2
has something do with 1 being the current month, but not sure what 2 is
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2011-03-24 : 11:19:55
Looks to me like a true/false statement, so the case would work.
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2011-03-24 : 11:28:16
looks like something is missing in front of
((IIf(InStr([tableA].[Name],"SomeName")<>0 
And [TableA].[DateOf]<date(),1,2))=2))







If you don't have the passion to help people, you have no passion
Go to Top of Page

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-03-24 : 14:59:35
quote:
Originally posted by RickD

Looks to me like a true/false statement, so the case would work.



Could be..
Go to Top of Page

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-03-24 : 15:00:22
quote:
Originally posted by yosiasz

looks like something is missing in front of
((IIf(InStr([tableA].[Name],"SomeName")<>0 
And [TableA].[DateOf]<date(),1,2))=2))







If you don't have the passion to help people, you have no passion




There is, but it's just a simply AND statement.
Go to Top of Page
   

- Advertisement -