1

I am running the following:

insert into [authentication].[dbo].[AspNetUserRoles] ("RoleId","UserId") 
values ("0918fb0f-79c0-4298-b184-9a754dc5c30e", "527ddbd5-14d3-4fb9-a7ae-374e66f635d4")

Here's my table:

CREATE TABLE [dbo].[AspNetUserRoles] (
    [RoleId] NVARCHAR (128) NOT NULL,
    [UserId] NVARCHAR (128) NOT NULL
);

However it's giving me an error saying:

Msg 207, Level 16, State 1, Line 2
Invalid column name '0918fb0f-79c0-4298-b184-9a754dc5c30e'.

Is there something wrong with the way I have coded the insert ?

4

1 回答 1

3

将值放入''not ""

insert into [authentication].[dbo].[AspNetUserRoles] ("RoleId","UserId") 
values ('0918fb0f-79c0-4298-b184-9a754dc5c30e',
        '527ddbd5-14d3-4fb9-a7ae-374e66f635d4');

问题是""它们周围的值被视为标识符而不是文字。就像在"RoleId","UserId".

于 2013-09-30T09:29:52.160 回答