|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 8:25 AM
Points: 37,738,
Visits: 30,011
|
|
prakash.kumar3669 (1/17/2013)
GilaMonster (1/17/2013) Index on (IsDeleted, SubmitDate DESC) include (ProdName,Category,TotalStock,Price)What would be the exact sql query to create the index.
Why don't you open up books online and read over Create Index.
btw, that's a rather odd predicate on the date column... how can you ellaborate ?
SubmitDate>=' ' and SubmitDate<' '
There is no possible way that any date can be both greater than or equal to '' and less than ''. Let me rephrase that into numbers...
WHERE SomeNumber >=0 AND SomeNumber < 0
That's completely, logically impossible as it is only true for a number that's both positive and negative at the same time, which no number is.
Either you mis-typed when you copied the query over, or there's some serious flawed logic at work.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 10:46 AM
Points: 7,
Visits: 19
|
|
WHERE SomeNumber >=0 AND SomeNumber < 0 this is the actual condition: SubmitDate>=DATEADD(day,DATEDIFF(day,0,GETDATE()),@duration) AND SubmitDate < DATEADD(day,DATEDIFF(day,0,GETDATE()),1)
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 10:46 AM
Points: 7,
Visits: 19
|
|
| @duration is negative number....like -1,-2,-3
|
|
|
|