Viewing 15 posts - 4,726 through 4,740 (of 5,588 total)
Look at the columns in the WHERE / HAVING clauses, and the JOIN conditions. Usually, your more selective columns would be first in the index.
Also, check the master.sys.dm_db_missing_index_xxx views.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 24, 2010 at 8:40 am
Joy Smith San (2/24/2010)
Wel, the number of records vary from 5000 to 1.2 million........mostly above a million.Thanks
If you can get us table definitions, test data and expected results (see the...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 24, 2010 at 8:34 am
thomas.hill (2/23/2010)
I changed it to:WHERE DateEnd >= '1/1/2009' and DateEnd <= '1/1/2010'
This means that you will return any DateEnd value in 2009, AND any DateEnd value of "1/1/2010 00:00:00.000". Nope,...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 24, 2010 at 7:04 am
mike 84768 (2/24/2010)
You could also use the Datepart function...returns an integer representation of the year.WHERE Datepart(yyyy,DateEnd) = 2009
The problem with this approach is that you won't be able to use...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 24, 2010 at 7:00 am
You know, the people that help out here are all un-paid volunteers. Providing the DDL scripts (CREATE TABLE, CREATE INDEX, etc.) for the tables affected, and INSERT statements to put...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 24, 2010 at 6:55 am
Paul White (2/24/2010)
RBarryYoung (2/23/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 24, 2010 at 6:43 am
RBarryYoung (2/23/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 24, 2010 at 4:40 am
It has often been found to be easier to use a different way than using BETWEEN when working with date ranges:
WHERE DateEnd >= '1/1/2009' and DateEnd < '1/1/2010' will get...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 23, 2010 at 8:32 pm
Paul White (2/23/2010)
WayneS (2/23/2010)
Steve Jones - Editor (2/23/2010)
Barry, sourced, quoted, limited to < 1 para, fair use.
Steve, while I agree, my question is whether a quote from a paid subscription...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 23, 2010 at 8:15 pm
johnnycash (2/23/2010)
I need some assistance and guidance. I have an XML file that I need to bring it into a SQL 2005 table. The problem is that...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 23, 2010 at 5:13 pm
Nugby,
I'm afraid that I gave you some bad advice.
From BOL:
TABLE
Specifies that the return value of the table-valued function is a table. Only constants and @local_variables can be passed to...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 23, 2010 at 5:00 pm
Steve Jones - Editor (2/23/2010)
Barry, sourced, quoted, limited to < 1 para, fair use.
Steve,
While I agree, my question is whether a quote from a paid subscription site (as where this...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 23, 2010 at 4:36 pm
Steve, this is the message I get:
Sorry your search results have expired within our database. Search results are held for around 30 minutes. You will need to perform your search...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 23, 2010 at 11:17 am
Paul White (2/23/2010)
WayneS (2/23/2010)
Paul White (2/22/2010)
Totally awesome job there Wayne.Fixed that for you, Paul. 😀
... but seriously, Thanks!
:laugh: funny :laugh:
Payback... just couldn't resist. 😛
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 23, 2010 at 2:05 am
Loops, by their very nature, process things Row-By-Agonizing-Row. SQL is a set-based language, and thus performs best with set-based code.
If you provide the DDL scripts (CREATE TABLE, CREATE INDEX, etc.)...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 23, 2010 at 2:03 am
Viewing 15 posts - 4,726 through 4,740 (of 5,588 total)