Search the Blog
Thursday, June 25, 2020
Wednesday, June 24, 2020
Sql Server Error Type 264, 512, 2601
Sql Server Error Type 264
INSERT INTO #CustomerService (
Dizsweb_companyID,
Dizsweb_UserID,
Dizsweb_Email,
Dizsweb_TransactionID,
Dizsweb_TransactionID
)
SELECT
DISTINCT CJ.ServiceID,
cs.CompanyID,
@UserID,
'sawanchauhan4@gmail.com',
'sawanchauhan4@gmail.com'
FROM CustomerService cs
Msg 264, Level 16, State 1, Line 127
The column name 'Dizsweb_TransactionID' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.
Sql Server Error Type 512
Example-1
Delete from DizswebService where DizswebServiceID =(
SELECT DizswebServiceID from DizswebService where ServiceName IN
('Sawan Chauhan','SQL Server Eror Description')
)
Example 2-
select * from workorderdizsweb where TransactionID =
( select TransactionID from Transaction where Transactionin
('SL Forms SQL',
'Monthly Recaps SQL',
'AMS Updates/Revisions SQL',
'Intro Letters SQL',
'Expirations Upload SQL'));
Solution of Example 2-
select * from workorderdizsweb where TransactionID IN ( select TransactionID from Transaction where Transactionin
('SL Forms SQL',
'Monthly Recaps SQL',
'AMS Updates/Revisions SQL',
'Intro Letters SQL',
'Expirations Upload SQL'));
Msg 512, Level 16, State 1, Line 212
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Solution - Pass one value at a time
Sql Server Error Type 2601
Insert Into dizsweb(
DIZSWEBID,
LOCATIONID,
Email)
values
(1,1,'sawanchauhn4@gmail.com'),(1,1,'pankaj@chauhan')
Msg 2601, Level 14, State 1, Line 136
Cannot insert duplicate key row in object 'dbo.CustomerService' with unique index 'IX_U_dizsweb_dizswebID_locationID'. The duplicate key value is (1, 1).
Cannot insert duplicate key row in object 'dbo.CustomerService' with unique index 'IX_U_dizsweb_dizswebID_locationID'. The duplicate key value is (1, 1).
Solution- remove duplicate composite key
Monday, June 22, 2020
The INSERT statement conflicted with the FOREIGN KEY constraint Error Type - 547
We are going to resolve the following error-The INSERT statement conflicted with the FOREIGN KEY constraint
Error Description for The INSERT statement conflicted with the FOREIGN KEY constraint |
Msg 547, Level 16, State 0, Procedure spMVC_Dizsweb_QAScore_InsertUpdate, Line 103 [Batch Start Line 0]
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_DizswebQAScoreCardAnswer_DizswebQAScoreCardSubCategoryID".
The conflict occurred in database "Dizsweb_Test",
table "dbo.DizswebQAScoreCardSubCategory",
column 'DizswebQAScoreCardSubCategoryID'.
To resolve this issue Please follow the following steps
STEP 1:-
Check the Foreign Key Constraints with the Help of following Query
sp_help Object_name
Step 2:-
Try to get the default value in foreign key
Case1- May be it will NULL and you are passing other than NULL
Case2- May be default is 0 are passing NULL
Case3- Value passing may be not exists in the table
Case4- Id removed from the table
Step 3-
Change the default value to the value which u r passing.
Subscribe to:
Posts (Atom)