Can I Create noncluster index on primary key column

  • I have some questions

    --- Can i create non cluster index on primary key column

    ---when we use triggers in sqlserver

    ---How to avoid cursors in sqlserver 2008

    Pls help me

  • kuna.venkatarao10 (2/8/2012)


    I have some questions

    --- Can i create non cluster index on primary key column

    ---when we use triggers in sqlserver

    ---How to avoid cursors in sqlserver 2008

    Pls help me

    1. Yes, specifiy the NON CLUSTERED index keyword when creating the key - If i remember correctly if you don't specify then the default is clustered

    2. To enforce business logic (read up on it). Example of a trigger could be to prevent db users from logging into the db out of office hours (i've seen it happen 🙂 )

    3. How would you avoid the plague? I personally haven't ever had the need to use a cursor, i'm sure there will be some more replied to this post with some further detail

    [font="Times New Roman"]There's no kill switch on awesome![/font]
  • kuna.venkatarao10 (2/8/2012)


    I have some questions

    --- Can i create non cluster index on primary key column

    ---when we use triggers in sqlserver

    ---How to avoid cursors in sqlserver 2008

    Pls help me

    Read this excellent article written by Jeff to understand how to avoid loops:

    Tally table, what it is & how it replaces a loop[/url]

    Preparing for the interview ;-)??


    Sujeet Singh

  • http://qa.sqlservercentral.com/articles/T-SQL/66097/[/url]

    Make sure to read all the way to the bottom so you will find the link to part 2.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply