If you get an error message while inserting records in a table.
Error message looks like : Cannot insert explicit value for identity column in table ‘dbo.InverterData’ when IDENTITY_INSERT is set to OFF.
to fix this ; SET IDENTITY_INSERT dbo.InverterData ON; before insert command and after insert enter this: SET IDENTITY_INSERT dbo.InverterData OFF;
SET IDENTITY_INSERT dbo.InverterData ON;
INSERT INTO dbo.InverterData
( Id, CurrentL1, CurrentL2, CurrentL3, GridFrequency, Power, SampleTime, Temperature, TotalEnergy, TotalEnergyToday, TotalHours, InverterId )
VALUES ( 5, 33, 43, 53,8,68,21/11/2011 13:00:00,210,2 );
SET IDENTITY_INSERT dbo.InverterData OFF;
GO