Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL SCRIPT

SQL SCRIPT

Scheduled Pinned Locked Moved Database
databasetoolshelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kibromg
    wrote on last edited by
    #1

    Hi Guys, I am having problem when running the Following SQL script.It takes Pretty long time to return result. I am having about 500,000 records in my database. select count(distinct(CR_Cli)),SO_name from Callrecords inner join dbo.StudioOperators On CR_StudioOperatorID=SO_ID where datename(month,cr_callstart)='April' and Cr_cli not in (select Cr_cli from Callrecords where cr_callstart<'2009-03-31') group by SO_name desc Is there any way i can write this script? Thanks you very much.

    D 1 Reply Last reply
    0
    • K kibromg

      Hi Guys, I am having problem when running the Following SQL script.It takes Pretty long time to return result. I am having about 500,000 records in my database. select count(distinct(CR_Cli)),SO_name from Callrecords inner join dbo.StudioOperators On CR_StudioOperatorID=SO_ID where datename(month,cr_callstart)='April' and Cr_cli not in (select Cr_cli from Callrecords where cr_callstart<'2009-03-31') group by SO_name desc Is there any way i can write this script? Thanks you very much.

      D Offline
      D Offline
      David Mujica
      wrote on last edited by
      #2

      In SQL Server Management Studio, place this query in the workspace and click on the icon that has a description of "display estimated execution plan". This will give you an idea of where there may be table scans and where you might be able to add an index to improve your performance. You should also check to see if your statistics are updated on the tables and indexes involved in this query before running the "display estimated execution plan" as described above. David

      K 1 Reply Last reply
      0
      • D David Mujica

        In SQL Server Management Studio, place this query in the workspace and click on the icon that has a description of "display estimated execution plan". This will give you an idea of where there may be table scans and where you might be able to add an index to improve your performance. You should also check to see if your statistics are updated on the tables and indexes involved in this query before running the "display estimated execution plan" as described above. David

        K Offline
        K Offline
        kibromg
        wrote on last edited by
        #3

        Thank you so much.It works

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups