---
title: "Inom datum"
type: "forum-thread"
url: "https://www.webforum.nu/amne/databaser-sql/168745-inom-datum"
topic: "Databaser & SQL"
topic_url: "https://www.webforum.nu/amne/databaser-sql"
author: "Dino"
published: "2008-02-05T12:14:20.000Z"
updated: "2008-02-05T12:57:28.000Z"
replies: 1
views: 462
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/databaser-sql/168745-inom-datum"
---

# Inom datum

## #1 — Dino, 2008-02-05T12:14Z

SQLServer2005

Är det någon skillnad på:

```
o.Date BETWEEN @startdate AND @enddate
```

och

```
o.Date >= @startdate AND o.Date < dateadd(day,1,@enddate)
```

Permalänk: https://www.webforum.nu/p/168745

## #2 — Dino, 2008-02-05T12:57Z

Fick svar.

> The difference is if you have time portion stored in table by using BETWEEN 
> caluse  you might ge a wrong result  as SQL Server 'removes' time portion.
> On the other hand with your second approac you WON'T  get a wrong data
> 
> Also, but you should be testing  it, with  the second option  you may get 
> betterw performance as SQL Server most likely use and index on the column.I 
> do not say that it does not with the first one, just test it.

Permalänk: https://www.webforum.nu/p/2077659

---

Tråden på webben: https://www.webforum.nu/amne/databaser-sql/168745-inom-datum
