Search the Blog

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).

Solution- remove duplicate composite key


No comments:

Post a Comment

Translate