locked
Gender(-), Salary composite clustered index RRS feed

  • Question

  • Hey Hi 

    I created composite clustered index key based on Gender and Salary column 

    The Query executed Successfully and <g class="gr_ gr_135 gr-alert gr_tiny gr_spell undefined ContextualSpelling multiReplace" data-gr-id="135" id="135">i</g> got composite index key id Gender(-), Salary

    I <g class="gr_ gr_310 gr-alert gr_gramm undefined Grammar only-ins replaceWithoutSep" data-gr-id="310" id="310">want</g> know why Gender(-) display like this? and Gender is <g class="gr_ gr_391 gr-alert gr_spell undefined ContextualSpelling ins-del multiReplace" data-gr-id="391" id="391">nvarchar</g> (20) 

    Thanks

    Vino

    Tuesday, November 24, 2015 12:45 PM

Answers

  • Gender(-) is because you have created the Clustered index with gender DESC

    Create table temp1
    (
    id int, 
    Gender char(1),
    Salary int
    )
    GO
    Create clustered index cl_idx_temp1 on temp1(gender desc,salary)
    sp_helpindex temp1
    /*
    index_name	index_description	index_keys
    cl_idx_temp1	clustered located on PRIMARY	Gender(-), Salary
    */


    Thanks Saravana Kumar C


    Tuesday, November 24, 2015 1:19 PM

All replies

  • Sorry can you tidy up post and provide screenshot of index as it is now? I didnt get the issue here. Are you talking about (-) part after gender?

    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Tuesday, November 24, 2015 12:50 PM
  • Gender(-) is because you have created the Clustered index with gender DESC

    Create table temp1
    (
    id int, 
    Gender char(1),
    Salary int
    )
    GO
    Create clustered index cl_idx_temp1 on temp1(gender desc,salary)
    sp_helpindex temp1
    /*
    index_name	index_description	index_keys
    cl_idx_temp1	clustered located on PRIMARY	Gender(-), Salary
    */


    Thanks Saravana Kumar C


    Tuesday, November 24, 2015 1:19 PM