Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8608993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:45:48+00:00 2026-06-12T03:45:48+00:00

I am using Sql Server Management Studio 2008. When I try to truncate a

  • 0

I am using Sql Server Management Studio 2008.

When I try to truncate a table using the following command

truncate table MyTable

it gives me an error saying

Cannot truncate table ‘dbo.MyTable’ because it is being referenced by a FOREIGN KEY constraint.

I know I have a foriegn Key in this table.

Now when I do the following

  • Right click on table and select Edit Top 200 Rows
  • Right on any records from the table
  • and hit Delete, it gets deleted.

enter image description here

I am confused with this behaviour, please can some one let me know how and why this happens and how do I delete using truncate statement.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:45:50+00:00Added an answer on June 12, 2026 at 3:45 am

    Basicly because there is a difference between DELETE and TRUNCATE

    If you could do that even a simple delete would work for those records. (If there is no reference on them, or if an ON DELETE statement is declared on the other table which made the reference to MyTable)

    DELETE FROM dbo.MyTable
    

    With the TRUNCATE you can’t do that. It is more then a DELETE. You have to remove the CONSTRAINT first and then you can make the Truncate. A Truncate is not allowed on a table which referenced by a forign_key.

    And for example an other difference a Truncate command reserts the IDENTITY columns as well, but a DELETE not.

    Here is a good article about it:

    The difference in TRUNCATE and DELETE in Sql Server

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SQL Server 2008 management studio to execute the following SQL statements,
I am using SQL Server Management Studio 2008 and writing the following query INSERT
Background: I'm using SQL Server Management Studio 2008 and I have a query window
I'm using SQL Server Management Studio 2008 and SQL Server 2008. Currently, I cannot
I have a problem when debugging stored procedure using SQL server Management Studio 2008.
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; What I'm ultimately trying to do is update a sql
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; Kinda new at C# here.. I got the first row
I tried to turn on the Activity Monitor using SQL Server 2008 Management Studio
I'm using Microsoft SQL Server 2008 Management Studio to create a relational schema by
Im using SQL Server Management Studio 2008 (ssms.exe) connected with a local SQL Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.