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. Delete Row Count

Delete Row Count

Scheduled Pinned Locked Moved Database
questiondatabasesql-serversysadmin
2 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.
  • S Offline
    S Offline
    Skanless
    wrote on last edited by
    #1

    Hello, I have a couple questions and would really appreciate your responses. Question: 1. If you are new to a database, is there a way that you can quickly find out relationships between the tables? 2. I need to retrieve information on all the tables in a database to find out which tables have a rowcount of more than 50,000 records then delete some record which thus reducing the table to 50,000 rows so as to make space. Is there a way to do that? and if so, what is the syntax to obtain this? 3. How can I cascade constraints when deleting records from a specific table? I am using SQL server 2000 to accomplish this task. Thanks

    Greg Coding makes the world go round!!!

    E 1 Reply Last reply
    0
    • S Skanless

      Hello, I have a couple questions and would really appreciate your responses. Question: 1. If you are new to a database, is there a way that you can quickly find out relationships between the tables? 2. I need to retrieve information on all the tables in a database to find out which tables have a rowcount of more than 50,000 records then delete some record which thus reducing the table to 50,000 rows so as to make space. Is there a way to do that? and if so, what is the syntax to obtain this? 3. How can I cascade constraints when deleting records from a specific table? I am using SQL server 2000 to accomplish this task. Thanks

      Greg Coding makes the world go round!!!

      E Offline
      E Offline
      Edbert P
      wrote on last edited by
      #2

      Skanless wrote:

      1. If you are new to a database, is there a way that you can quickly find out relationships between the tables?

      There are diagrams that you can create to see the relationship between the tables.

      Skanless wrote:

      2. I need to retrieve information on all the tables in a database to find out which tables have a rowcount of more than 50,000 records then delete some record which thus reducing the table to 50,000 rows so as to make space. Is there a way to do that? and if so, what is the syntax to obtain this?

      You can use the sysobjects table that can return the tables existing in your database, then query each table to check how many records it has and delete the ones over 50,000. I can't remember the correct syntax, I'm sure a bit of googling will do.

      Skanless wrote:

      3. How can I cascade constraints when deleting records from a specific table?

      You need to specify the necessary constraints to the tables before deleting the record, and it will automatically trigger the deletion of child records.

      "A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin Edbert Sydney, Australia

      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