getdate function in sql 2000

Hi Experts.
I have a table calendar in sql 2000
it has 1 column named "dt" storing date the format of storing a date is

' 2004-02-02 00:00:00 '
now in 1 stored procedure i need to extract data based on todays date and then matching it dt column

when i get todays date using getdate() it is in different format

which is
'  Jan 28 2007 10:52AM '
how do i change this format matching to my stored format.

my second question is how i can just retrieve date part from ym dt column ?


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
if your column is of data type datetime, you don't have any problems:

select * from yourtable where yourfield >= getdate()

if the field is not datetime, but varchar (bad idea):

select * from yourtable where convert(datetime,yourfield,120) >= getdate()
bsheikhAuthor Commented:
my datatype for that column is smalldatetime

but somehow it is not matching with getdate() as it is in different format.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
don't get confused on what you SEE, that is only a display/formatting issue.
when you compare date/time values/columns, there is no "format" used, only the underlying value
bsheikhAuthor Commented:
problem is solves here is the working query.


select @FISCAL_YEAR=FY from calendar where dt=convert(nvarchar,getdate(),101)

Closed, 75 points refunded.
The Experts Exchange
Community Support Moderator of all Ages

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.