Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 indexes

Author  Topic 

abcd
Yak Posting Veteran

92 Posts

Posted - 2009-01-12 : 06:12:32
hi...
i am practising indexes...
i have created on index on a table....
but now how to execute any query ...
sample data is as follows...


SELECT be_date,product_description
FROM jnpt
WHERE be_number BETWEEN '654728' and N'654735';

CREATE INDEX IX_BE_Number
ON jnpt (be_number)
INCLUDE (be_date,product_desicription);

where jnpt is name of a table and be_date,product_description,be_number.

do help....

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-12 : 09:06:30
Execute the query after creating index and see execution plan if it effectively used.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-12 : 09:13:47
if you're sking for forcing use of index, then use index hint like

SELECT be_date,product_description
FROM jnpt with (index IX_BE_Number )
WHERE be_number BETWEEN '654728' and N'654735';

Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-12 : 09:21:14
quote:
Originally posted by visakh16

if you're sking for forcing use of index, then use index hint like

SELECT be_date,product_description
FROM jnpt with (index IX_BE_Number )
WHERE be_number BETWEEN '654728' and N'654735';





The index will be definitely be used as Where clause contains index column and search columns are also covered with include part.
Go to Top of Page

abcd
Yak Posting Veteran

92 Posts

Posted - 2009-01-12 : 23:26:45
sir may i know how this query is working,,,i made this query with the help of some examples...but how this is working i realy want to know.........

and also suggest some points on table partitioning...
is it necesarry to create file groups according to the table partitioning??

quote:
Originally posted by visakh16

if you're sking for forcing use of index, then use index hint like

SELECT be_date,product_description
FROM jnpt with (index IX_BE_Number )
WHERE be_number BETWEEN '654728' and N'654735';



Go to Top of Page
   

- Advertisement -