{"id":89,"date":"2014-05-15T20:35:00","date_gmt":"2014-05-15T19:35:00","guid":{"rendered":"https:\/\/debuggersspace.com\/index.php\/2014\/05\/15\/surrogate-key-in-sql-server\/"},"modified":"2014-05-15T20:35:00","modified_gmt":"2014-05-15T19:35:00","slug":"surrogate-key-in-sql-server","status":"publish","type":"post","link":"https:\/\/debuggersspace.com\/index.php\/2014\/05\/15\/surrogate-key-in-sql-server\/","title":{"rendered":"Surrogate Key in SQL Server?"},"content":{"rendered":"<div class='booster-block booster-read-block'>\n                <div class=\"twp-read-time\">\n                \t<i class=\"booster-icon twp-clock\"><\/i> <span>Read Time:<\/span>6 Minute, 3 Second                <\/div>\n\n            <\/div><div dir=\"ltr\" style=\"text-align: left;\">\n<div style=\"background-color: white; color: #333333; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">Introduction<\/b><br style=\"outline: none 0px;\" \/>A Surrogate Key in SQL Server is a unique identifier for each row in the table. It is just a key. Using this key we can identify a unique row. There is no business meaning for Surrogate Keys. This type of key is either database generated or generated via another application (not supplied by user).&nbsp;<br style=\"outline: none 0px;\" \/><br style=\"outline: none 0px;\" \/>A Surrogate Key is just unique identifier for each row and it may use as a Primary Key. There is only requirement for a surrogate Primary Key, which is that each row must have a unique value for that column. A Surrogate Key is also known as an artificial key or identity key. It can be used in data warehouses.<br style=\"outline: none 0px;\" \/><br style=\"outline: none 0px;\" \/>A Surrogate Key should have the following characteristics:<\/span><\/div>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">Unique Value<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">The key is generated by the system, in other words automatically generated<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">The key is not visible to the user (not a part of the application)<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">It is not composed of multiple keys<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">There is no semantic meaning of the key<\/span><\/li>\n<\/ul>\n<div style=\"background-color: white; color: #333333; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">Generally, a Surrogate Key is a sequential unique number generated by SQL Server or the database itself. The purpsoe of a Surrogate Key is to act as the Primary Key. There is a slight difference between a Surrogate Key and a Primary Key. Ideally, every row has both a Primary Key and a Surrogate Key. The Primary Key identifies the unique row in the database while the Surrogate Key identifies a unique entity in the model.<br style=\"outline: none 0px;\" \/><br style=\"outline: none 0px;\" \/>Note that Surrogate Keys are never used with any business logic other than simple&nbsp;Create, Read, Update and Delete (CRUD) operations.<br style=\"outline: none 0px;\" \/><br style=\"outline: none 0px;\" \/><b style=\"outline: none 0px;\">Example of Surrogate Key<\/b><\/span><\/div>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">Identity Column in SQL Server<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">GUID (Globally Unique Identifier)<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">UUID (Universally Unique Identifier)<\/span><\/li>\n<\/ul>\n<div style=\"background-color: white; color: #333333; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"outline: none 0px;\"><b style=\"outline: none 0px;\">How can we implement Surrogate Key?<\/b><br style=\"outline: none 0px;\" \/>There are several ways to implement Surrogate Keys&nbsp;<\/span>as in the following:<\/span><\/div>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">Auto Incremental key in Database<\/b><\/span>\n<div style=\"outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A Surrogate Key can be implementing by an auto incremented key. SQL Server supports an IDENTITY column to perform the auto increment feature. It allows a unique number to be generated when a new record is inserted into the database table.<\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"color: green; outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">&#8211;Syntax for Introducing Auto identity column with Create Table.<\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"color: blue; outline: none 0px;\">CREATE<\/span><span style=\"outline: none 0px;\"><span style=\"color: blue; outline: none 0px;\">TABLE<\/span>&nbsp;[dbo]<span style=\"color: grey; outline: none 0px;\">.<\/span>[EmployeeMaster]<span style=\"color: grey; outline: none 0px;\">(<\/span><\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">[EmployeeId] [int]<span style=\"color: blue; outline: none 0px;\">IDENTITY<\/span><span style=\"color: grey; outline: none 0px;\">(<\/span>1<span style=\"color: grey; outline: none 0px;\">,<\/span>1<span style=\"color: grey; outline: none 0px;\">)<\/span><span style=\"color: grey; outline: none 0px;\">NOT<\/span>&nbsp;<span style=\"color: grey; outline: none 0px;\">NULL,<\/span><\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">[EmployeeCode] [varchar]<span style=\"color: grey; outline: none 0px;\">(<\/span>25<span style=\"color: grey; outline: none 0px;\">)<\/span><span style=\"color: grey; outline: none 0px;\">NULL,<\/span><\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">[EmployeeName] [varchar]<span style=\"color: grey; outline: none 0px;\">(<\/span>50<span style=\"color: grey; outline: none 0px;\">)<\/span><span style=\"color: grey; outline: none 0px;\">NULL,<\/span><\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">[EmailAddress] [varchar]<span style=\"color: grey; outline: none 0px;\">(<\/span>50<span style=\"color: grey; outline: none 0px;\">)<\/span><span style=\"color: grey; outline: none 0px;\">NULL,<\/span><\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"color: grey; outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">)<\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"color: green; outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">&#8211;Syntax for Introducing Auto identity column with Create Table.<\/span><\/span><\/div>\n<div style=\"line-height: 16.866666793823242px; margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"color: blue; line-height: 15.333333015441895px; outline: none 0px;\">ALTER<\/span><span style=\"line-height: 15.333333015441895px; outline: none 0px;\"><span style=\"color: blue; outline: none 0px;\">TABLE<\/span>&nbsp;EmployeeMaster<span style=\"color: blue; outline: none 0px;\">ADD<\/span>&nbsp;ID&nbsp;<span style=\"color: blue; outline: none 0px;\">INT<\/span><span style=\"color: blue; outline: none 0px;\">IDENTITY<\/span><span style=\"color: grey; outline: none 0px;\">(<\/span>1<span style=\"color: grey; outline: none 0px;\">,<\/span>1<span style=\"color: grey; outline: none 0px;\">)<\/span><\/span><\/span><\/div>\n<\/li>\n<\/ul>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">Manual Incremental key in Database<\/b><\/span>\n<div style=\"outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A Surrogate Key can be implemented by manual incremental key. Using the max() function we can find a maximum value of a column and this value is incremented by one. This approach suffers from a performance problem when a table has a large amount of data.<\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"color: green; outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">&#8211;Example<\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"color: blue; outline: none 0px;\">DECLARE<\/span><span style=\"outline: none 0px;\">&nbsp;@newId&nbsp;<span style=\"color: blue; outline: none 0px;\">INT<\/span><\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"color: blue; outline: none 0px;\">SELECT<\/span><span style=\"outline: none 0px;\">&nbsp;@newId&nbsp;<span style=\"color: grey; outline: none 0px;\">=<\/span>&nbsp;<span style=\"color: magenta; outline: none 0px;\">ISNULL<\/span><span style=\"color: grey; outline: none 0px;\">(<\/span><span style=\"color: magenta; outline: none 0px;\">MAX<\/span><span style=\"color: grey; outline: none 0px;\">(<\/span>EmployeeId<span style=\"color: grey; outline: none 0px;\">),<\/span>0<span style=\"color: grey; outline: none 0px;\">)<\/span><span style=\"color: grey; outline: none 0px;\">+<\/span>&nbsp;1&nbsp;<span style=\"color: blue; outline: none 0px;\">FROM<\/span>&nbsp;EmployeeMaster<\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"color: blue; outline: none 0px;\">PRINT<\/span><span style=\"outline: none 0px;\">&nbsp;@newId<\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"color: green; outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">&#8211;The varible @newId can be used as indentifier of newly inserted data.<\/span><\/span><\/div>\n<\/li>\n<\/ul>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">Globally Unique Identifiers (GUID)<\/b><\/span>\n<div style=\"outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">GUID is a Microsoft standard that extends&nbsp;Universally Unique Identifier (UUID). Using a NEWID() function we can generate a new GUID in SQL Server. It is a 16 byte GUID.<\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"color: green; outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">&#8211;Example<\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"color: blue; outline: none 0px;\">DECLARE<\/span><span style=\"outline: none 0px;\">&nbsp;@newID&nbsp;<span style=\"color: blue; outline: none 0px;\">UNIQUEIDENTIFIER<\/span><\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"color: blue; outline: none 0px;\">SET<\/span><span style=\"outline: none 0px;\">&nbsp;@newID&nbsp;<span style=\"color: grey; outline: none 0px;\">=<\/span>&nbsp;<span style=\"color: magenta; outline: none 0px;\">NEWID<\/span><span style=\"color: grey; outline: none 0px;\">()<\/span><\/span><\/span><\/div>\n<div style=\"margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"color: green; outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif;\">&#8211;The varible @newId can be used as indentifier of newly inserted data.<\/span><\/span><\/div>\n<div style=\"line-height: 16.866666793823242px; margin: 0in 0in 0pt; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><b style=\"outline: none 0px;\"><span style=\"line-height: 15.333333015441895px; outline: none 0px;\"><\/span><\/b><span style=\"outline: none 0px;\"><br style=\"outline: none 0px;\" \/>NEWSEQUENTIALID() can be used with DEFAULT constraints on the table column of type uniqueidentifier. We cannot use the NEWSEQUENTIALID() function as a reference in queries.<\/span><\/span><\/div>\n<\/li>\n<\/ul>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">Universally unique identifier (UUID)<\/b><br style=\"outline: none 0px;\" \/><br style=\"outline: none 0px;\" \/>UUID is 128 bit values that are created from hash of the ID of Ethernet card and current data time of SQL Server.<\/span><\/li>\n<\/ul>\n<div style=\"background-color: white; color: #333333; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">Advantages of Surrogate Key<\/b><\/span><\/div>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A Surrogate Key does not change so the application cannot lose their reference row in the database.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">If the Primary Key is changed then the related foreign key does not change across the database because the Surrogate Key is used as a reference key. In other words, the Surrogate Key value is never changed, so the foreign key values become stable.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A Surrogate Key is most often a compact data type such as an integer. A Surrogate Key is less expensive in a &#8220;Join&#8221; than the compound key.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">Business logic does not something in this key.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A table always has a uniform Surrogate Key, so some tasks can be easily automated by writing the code table independently.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">There is no locking contention because it is a unique identifier.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A Surrogate Key does not require an extra field; that helps to save space in the database.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">The relationship between any two tables is simple and consistent in SQL code expressions.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">Object Relational Mapping (ORM) frameworks such as Entity Framework, N-Hibernate, and so on are designed to work optimally with Surrogate Keys. It is very simple to implement them over the composite keys.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">It allows for a higher degree of normalization, so data is not duplicated within the database.<\/span><\/li>\n<\/ul>\n<div style=\"background-color: white; color: #333333; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">Disadvantages of Surrogate Key<\/b><\/span><\/div>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">Additional index is required.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">It cannot be used as a search key because it is not related to any business logic or it is independent of any business logic.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">There is always a requirement to join to the main table when data is selected from a child table.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">It increases the sequential number by a random amount.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">There is some administrative overhand to maintain a Surrogate Key.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">Extra disk space required to store a Surrogate Key.<\/span><\/li>\n<\/ul>\n<div style=\"background-color: white; color: #333333; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">How Surrogate Key is differing from the Natural Key?<\/b><br style=\"outline: none 0px;\" \/>The alternative to a Surrogate Key is Natural Keys. A Natural Key is a true unique identifier in the database. It is a single value or composite value that has business meaning. The Natural Key can be one or more columns with any data type. If there is no Surrogate Key on table then there is no need to create a unique index or sequence on a database table, so it helps us to reduce administrative overhead.<br style=\"outline: none 0px;\" \/><br style=\"outline: none 0px;\" \/><b style=\"outline: none 0px;\">Disadvantages of Natural Key<\/b><\/span><\/div>\n<ul style=\"background-color: white; color: #333333; outline: none 0px;\">\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A query join may become complex because the Natural Key can have one or more columns.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">It is a reduced normalization form.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">It is very difficult to use and time consuming with ORM because ORM is designed to work best with Surrogate Keys.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">The key type is not consistent.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">More work is required to change a Natural Key when the foreign key relationship has been built by a Natural Key.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A Natural Key is larger than a Surrogate Key.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A Natural Key can be any data type, so it might require a long execution time in a &#8220;join&#8221; query. For example, if there is a VARCHAR data type as a Natural Key type then the join between two tables may take more time to produce output.<\/span><\/li>\n<li style=\"outline: none 0px;\"><span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\">A Natural Key is assigned by the application, so there is no way to know whether a record is&nbsp;new or an existing record.<\/span><\/li>\n<\/ul>\n<div style=\"background-color: white; color: #333333; outline: none 0px;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif; outline: none 0px;\"><b style=\"outline: none 0px;\">Conclusion<br style=\"outline: none 0px;\" \/><\/b>A Surrogate Key is unique in the database table; it is just like an artificial or alternative key to a Primary Key because a Primary Key may be alphanumeric or a composite key. A Surrogate Key is always unique per table.<br style=\"outline: none 0px;\" \/><br style=\"outline: none 0px;\" \/>Surrogate Keys offer many benefits. Simplicity, consistency and stability, makes the use of an ORM extremely feasible. We can use a Natural Key instead of A Surrogate Key when A Natural Key is small and this key is never updated.<\/span><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>IntroductionA Surrogate Key in SQL Server is a unique identifier for each row in the table. It is just a key. Using this key we can identify a unique row. There is no business meaning for Surrogate Keys. This type of key is either database generated or generated via another application (not supplied by user).&nbsp;A [&hellip;]<\/p>\n","protected":false},"author":43,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[34,27],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry","category-ibm","category-sql"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Himanshu Namdeo","author_link":"https:\/\/debuggersspace.com\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"IntroductionA Surrogate Key in SQL Server is a unique identifier for each row in the table. It is just a key. Using this key we can identify a unique row. There is no business meaning for Surrogate Keys. This type of key is either database generated or generated via another application (not supplied by user).&nbsp;A&hellip;","_links":{"self":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/89"}],"collection":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":0,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/89\/revisions"}],"wp:attachment":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/media?parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/categories?post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/tags?post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}