You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
- @Beginner: you are though, hence the error. How are we to know that you don't want to insert values? We only have an error messagegbn– gbn2011-08-15 09:47:38 +00:00Commented Aug 15, 2011 at 9:47
- 5Error is from my app when i do DB.SaveChanges();Beginner– Beginner2011-08-15 09:50:19 +00:00Commented Aug 15, 2011 at 9:50
- 5No, just stop sending a value for the identity column. Or set it if you want in your app if you want to send a value..... but then why have a column with the identity property set to generate values? We can't decide for yougbn– gbn2011-08-15 10:01:55 +00:00Commented Aug 15, 2011 at 10:01
- 31@Beginner: The setting is only applicable in the current session (no one quite pointed that out for this question), so your application would have to turn it on in order for the application to perform such inserts (and it's probably best to promptly turn it off again when such inserts are concluded, like gbn shows). How you were inserting a value on the identity column without realizing it isn't clear, but perhaps older versions of SQL Server would include it implicitly with all columns when explicit insert columns are not specified (?) as Ismael seems to suggest.Rob Parker– Rob Parker2013-06-03 18:55:37 +00:00Commented Jun 3, 2013 at 18:55
- 2@Rob, I think you havea point adn I personally fail code review on any code that does na insert without specifying columns. Aside from the time wasted on an error, this is a risky practice and you can end up with serious data integrity problems if the column data doesn't match up correctly.HLGEM– HLGEM2013-11-05 22:25:11 +00:00Commented Nov 5, 2013 at 22:25
| Show 4 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. python-3.x), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-sql