0

I almost feel silly asking such a simple question but I have an ASP.NET Core application that I am trying to configure the email sender upon user registration correctly.

I have registered my email and it didn't work and so in order to test again I need to drop my user data from the database because currently my email I used already is registered but never sent me an email to confirm so I can't log in anyway. All I need to do is drop the data from the scaffolded ASP.NET Core identity users table but anytime I try to target the table using SSMS it just tells me either the table doesn't exist (even though I can pull up the table and see my email and data) or gives me an "incorrect syntax near identity" message.

So there it is - can you edit the scaffolded identity tables from ASP.NET Core using a SQL command?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

Edit: Identity is a reserved keyword, which you should avoid using. This still should work by putting square brackets around keywords though, e.g.:

SELECT * FROM TomatoPizzaCafe.[Identity].AspNetUsers

Initial: You should be able to do that, but data in the AspNetUsers table is referenced by some other tables, i.e. AspNetUserClaims, AspNetUserLogins, AspNetUserRoles, AspNetUserTokens. So to remove AspNetUsers, you first need to remove data related to them in the mentioned (and maybe also some of your custom) tables.

Note that SQL Server Management Studio usually tells you the exact cause of such issues.

user7217806
  • 2,014
  • 2
  • 10
  • 12
  • Thank you for your response! Yes usually SSMS has great error reports but as per this issue all it is telling me is "incorrect syntax near Identity" so in my mind it seems that SSMS is picking up the word identity as the SQL command when in reality it is the name of the schema my table is located in. Not sure how correct that is though. – Eddie Crochet Sep 15 '19 at 20:47
  • 1
    Thank you so much! I could not find anything on this. Unfortunately asp.net core automatically names this folder Identity by default. – Eddie Crochet Sep 18 '19 at 23:56