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
 SQL Server Development (2000)
 How can I compare two dates in YYYYMMDD format?

Author  Topic 

lanejc
Starting Member

11 Posts

Posted - 2002-04-30 : 08:58:23
I have a table that stores dates in a string format of YYYYMMDD. I need to write an SQL query against this table and only return the current date values. I've tried using some of the concepts that I've found about dates in my SQL statement but all I get are errors.

Can someone explain how I can compare a column in the table against the current date in the YYYYMMDD format?

Thanks for all the help.

Nazim
A custom title

1408 Posts

Posted - 2002-04-30 : 09:02:28
Check for Convert function in BOL.

Convert(varchar(12),columnname,112)= convert(varchar(12),getdate(),112)


HTH

--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -