R
R
Roman Gamretsky2014-06-05 21:44:07
Database design
Roman Gamretsky, 2014-06-05 21:44:07

Can primary key be of type string?

The key field can be of type string? When trying to migrate after the update-database command, the following error occurs:
Identity column must be of data type int, bigint, smallint, tinyint, or decimal or numeric with a scale of 0, and constrained to be non nullable
How to fix? Let me know who you met.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sumor, 2014-06-05
@rgamretsky

It depends on the DB. In SQL Server you can. In your DBMS - obviously it is impossible. Add an identity field to your table schema and it will automatically populate as you add rows.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question