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

  • SEARCH
  • Home
  • 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 3391000
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:45:20+00:00 2026-05-18T03:45:20+00:00

I have renamed a table in a SQL Server 2008 database, from eL_CourseStepUserNotes to

  • 0

I have renamed a table in a SQL Server 2008 database, from eL_CourseStepUserNotes to StepUserNotes. I renamed the table using the SSMA.

The table is used in a ASP.NET 4.0 app. I use LINQ to SQL for all CRUD. The problem is that the following code:

    dbDataContext db = new dbDataContext();
    var k = (from c in db.StepUserNotes
             where ((c.CourseStepFK == q.CourseStepFK) && (c.UserFK == q.UserFK))
             select c).FirstOrDefault();
    try
    {
        db.StepUserNotes.InsertOnSubmit(q);
        db.SubmitChanges();
    }
    catch
    {

    }

Fails on the db.SubmitChanges line, saying:

SqlException was caught. Invalid object name 'eL_CourseStepUserNotes'.

Ie, the old name for the table has come back to haunt me.

I have deleted the old LINQ to SQL dbml file and created a new one. I have searched through all the source code for strings that contain the old table name. Nothing. The code compiles…

Where else can I look?

The error is coming back from SQL Server, and using the utility for listing all foreign keys in a sql server database shown in SO question:
sql:need to change constraint on rename table?

reveals no sign of the old table name in FKs either.

I am at a complete loss as to where to look or what to try next. Any suggestions?

  • 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-05-18T03:45:20+00:00Added an answer on May 18, 2026 at 3:45 am

    Answer:

    The problem, as stated by Stu and Stark was a trigger. Stu gave me the SQL to run that nailed the problem. It is documented here in case anyone else runs into this:

    Select Object_Name(ID) From SysComments 
           Where Text Like '%el_CourseStepUserNotes%'
    

    This revealed a trigger with the following name:

    tr_eL_CourseStepUserNotes
    

    The trigger referenced the old name as follows:

    SET DateAmended = CURRENT_TIMESTAMP
         FROM eL_CourseStepUserNotes PP  
                INNER JOIN inserted i  ON PP.UserNoteId = i.UserNoteId
    

    Everything is now working again.

    Silly me, I should have realised that a trigger was the problem as the first error I got was related to the DateAmended field.

    I have no idea why a trigger would update when a table name changed. I had checked all Keys and relationships, but forgot this trigger.

    Live and learn.

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

Sidebar

Related Questions

we have a big portal that build using SharePoint 2007 , asp.net 3.5 ,
I'm using SQL Server 2008. I should be able to connect to a user-specified
I have added an linked server from an SQL 2000 server to an SQL
Is it possible to have a relationship from a user table to a system
I am trying to alter a table in SQL server with a script. In
I have a table that has an ntext column defined as [value1] [ntext] NOT
I'm trying to copy sql db between servers using Smo.Transfer class. And it's ok
During my apprenticeship, I have used NHibernate for some smaller projects which I mostly
I am trying to load an Excel 97 single tabbed spreadsheet into a SQL
I have two tables with 10-20 million rows that have GUID primary keys and

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.