Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2005, 05:44 AM
Authorized User
 
Join Date: Apr 2004
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help me please

I have create a Table has smalldateTime datatype
and I set its default value =getdate() funtion
when i insert new data i found it automatical insert '3/26/2005 2:53:00 PM'
And later I want to get all the record that i have inserted today
as this query SELECT * FROM MY TABLE'S NAME WHERE Publish_Date=GETDATE()
I GET NO ROCORD
WHAT 's problem ? How to do to fixed this error ?

thanks for your help

 
Old March 28th, 2005, 10:23 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When you use GetDate() is also has current time along with today's date so when you compare it will not return any result?

SELECT field1, field2...
FROM MyTable
WHERE DateDiff(dd, publish_date, GetDate())=0





 
Old March 28th, 2005, 10:52 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OR

SELECT *
From Table6
WHERE Convert(varchar(10),publish_date,101) = Convert(varchar(10), GetDate(),101)

 
Old March 28th, 2005, 06:52 PM
Authorized User
 
Join Date: Mar 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes
shahchi1 is right.

atul

 
Old March 28th, 2005, 11:17 PM
Authorized User
 
Join Date: Apr 2004
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes ! You are all right
Thanks shahchi1










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.