July 24, 2018 at 1:11 am
I have the following Code
INSERT INTO dbo.Region (RegionID, RegionDescription)
VALUES (5, 'Space')
select RegionID, RegionDescription
from dbo.Region
where regionID = 5
/*
and trying
SELECT SCOPE_IDENTITY();
*/
But getting the following tip:
Table look like this:
July 24, 2018 at 1:24 am
Please post the DDL script for the table. I think the insert operation is not happening successfully. Do you have IDENTITY set in the RegionID column?
July 24, 2018 at 1:37 am
debasis.yours - Tuesday, July 24, 2018 1:24 AMPlease post the DDL script for the table. I think the insert operation is not happening successfully. Do you have IDENTITY set in the RegionID column?
SET IDENTITY_INSERT RegionID ON;
INSERT INTO Region (RegionID, RegionDescription)
VALUES (5, 'Space');
SET IDENTITY_INSERT RegionID OFF;
select RegionID, RegionDescription
from dbo.Region
where RegionID = 5
I have try this but still get the same error..
July 24, 2018 at 1:48 am
Hi,
You have a wrong statement here. In the below statement, you have used column name in place of the expected table name. Please check.
SET IDENTITY_INSERT <TableName> ON;
SET IDENTITY_INSERT <TableName> OFF;
Also, please check what value you are getting by this:
SELECT IDENT_CURRENT('Region')
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply