TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
473.4k
How can i fix this issue on my query?
Mar 9 2020 4:20 AM
Hi Team
I am trying to write this query for AspNetUserRoles, but i am thrown to this exception and need some help.
// Error is as follows
Msg 1753, Level 16, State 0, Line 2
Column 'dbo.AspNetRoles.Id' is not the same length or scale as referencing column 'AspNetUserRoles.RoleId' in foreign key 'FK_dbo.AspNetUserRoles_dbo.AspNetRoles_RoleId'. Columns participating in a foreign key relationship must be defined with the same length and scale.
Msg 1750, Level 16, State 1, Line 2
Could not create constraint or index. See previous errors.
Msg 1088, Level 16, State 12, Line 7
Cannot find the object "dbo.AspNetUserRoles" because it does not exist or you do not have permissions.
Msg 102, Level 15, State 1, Line 16
Incorrect syntax near '.'.
CREATE
TABLE
[dbo].[AspNetUserRoles] ( [UserId] NVARCHAR (128)
NOT
NULL
, [RoleId] NVARCHAR (256)
NOT
NULL
,
CONSTRAINT
[PK_dbo.AspNetUserRoles]
PRIMARY
KEY
CLUSTERED ([UserId]
ASC
, [RoleId]
ASC
),
CONSTRAINT
[FK_dbo.AspNetUserRoles_dbo.AspNetRoles_RoleId]
FOREIGN
KEY
([RoleId])
REFERENCES
[dbo].[AspNetRoles] ([Id])
ON
DELETE
CASCADE
,
CONSTRAINT
[FK_dbo.AspNetUserRoles_dbo.AspNetUsers_UserId]
FOREIGN
KEY
([UserId])
REFERENCES
[dbo].[AspNetUsers] ([Id])
ON
DELETE
CASCADE
);
GO
CREATE
NONCLUSTERED
INDEX
[IX_UserId]
ON
[dbo].[AspNetUserRoles]([UserId]
ASC
);
GO
CREATE
NONCLUSTERED
INDEX
[IX_RoleId]
ON
[dbo].[AspNetUserRoles]([RoleId]
ASC
);
Reply
Answers (
2
)
Find UnUsed Stored Procedures in Sql 2008
data between 2 date ranges and time range