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
 General SQL Server Forums
 New to SQL Server Programming
 wildcard string in sql

Author  Topic 

pavlos
Yak Posting Veteran

59 Posts

Posted - 2011-12-18 : 19:51:39
hey guys..
this returns result

select id, TRANSACTIONNUMBER, STORECODE, TXNPROCDATE from POS2SAP_Staging.dbo.TXNHEADER
where TXNPROCDATE = '2011-10-04 22:29:29.217'

however..
i only want to enter in '2011-10-04' and that returns no results
Eg.
select id, TRANSACTIONNUMBER, STORECODE, TXNPROCDATE from POS2SAP_Staging.dbo.TXNHEADER
where TXNPROCDATE = '2011-10-04'

the query above works! and returns results

i have tried
where TXNPROCDATE like '2011-10-04' and also tried
where TXNPROCDATE like '2011-10-04%'

and both returned no results..
any ideas?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-18 : 20:22:24
as the TXNPROCDATE column contains date & time, you will need to do this

where TXNPROCDATE >= '2011-10-04'
and TXNPROCDATE < dateadd(day, 1, '2011-10-04')



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -