A Quick Tip On How To Ignore Time When Querying From SqlServer(peterkellner.net)

submitted by rcashrcash(4149) 8 months, 17 days ago

Using Microsoft’s SqlServer, you may want to query all records that are on a certain date This post shows two common SQL statements for this common issue.

2 comments |category: |Views: 26

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by dpetersondpeterson(4397) 8 months, 17 days ago 0

This is actually very bad advice from the author here. By using the function in the where clause, you negate any indexes or statistics that sql server has on that column. It will have to do a table scan for that query, and will absolutely kill performance.
A commenter on the blog post also pointed this out, and another commenter offers an alternative which looks clean but does not discard indexes.

Reply

posted by vijaystvijayst(1311) 8 months, 15 days ago 0

I usually use a SQL query like this:
SELECT * FROM VolunteerJobs WHERE JobStartTime >= '08-01-2008' AND JobStartTime < '08-02-2008'

Reply

information Login or create an account to comment on this story