Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9290649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:28:11+00:00 2026-06-18T20:28:11+00:00

I have this weird problem, I have created a table with four column, and

  • 0

I have this weird problem, I have created a table with four column, and set one column as primary key with int type. I DID NOT set the primary key column as identity, but when I try to insert data in the table I get this error:

Cannot insert explicit value for identity column in table 'Table1' when IDENTITY_INSERT is set to OFF.

I tried to insert without specifying the primary key column (assuming it IS set to IDENTITY(x,y)!), in this this case it doesn’t gives any error, but it doesn’t insert any data neither!

creating the ‘table1’:

    USE [NEWVEDJA]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Table1](
        [id] [int]  NOT NULL,
        [name] [nvarchar](50) NULL,
        [code] [int] NULL,
        [exp_1] [nvarchar](max) NULL,
     CONSTRAINT [PK_Table1] PRIMARY KEY CLUSTERED 
    (
        [id] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF,         ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO

and inserting into ‘table1’

    INSERT INTO [PARTIAL_NEWVEDJA].[dbo].[Table1]
           ([id]
           ,[name]
           ,[code]
           ,[exp_1])
        VALUES
            (1,N'سازمان',null,null), (2,N'معاونت',null,null);
    GO

thanks a lot in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:28:12+00:00Added an answer on June 18, 2026 at 8:28 pm
    USE [NEWVEDJA]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE....
    

    With this code, the table is created with ID as PK without the IDENTITY property. All is well.

    INSERT INTO [PARTIAL_NEWVEDJA].[dbo].[Table1]
           ([id]
    

    With this code, you are inserting data into [PARTIAL_NEWVEDJA].[dbo].[Table1], which is a table in another DB. Looks like IDENTITY property is enabled in that table for ID column.

    Can you try inserting data into the same table that you have created with your CREATE statement?

    Raj

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a weird problem. I have created Web User Control with two TextBoxes
I have this weird problem. I have defined a column in a SQLite database
I have this really weird problem with my MySQL table. After some time a
im a newbie to flash,and i hav got this really weird problem.i have created
I am facing this very weird problem, I have created a custom UITableViewCell on
I have a weird problem. I create this window, but its blank until i
I have this weird problem with setting up cookies with PHP. Everything worked fine
This is a weird problem. I have a solution for it, but I don't
I have a weird problem, and I don't know if this is the default
Ok, this one is weird, i have this code: $('#nps').submit(function(e) { e.preventDefault(); var images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.