久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

SQL Server 中是否每條記錄都有唯一的字段?

Does every record has an unique field in SQL Server?(SQL Server 中是否每條記錄都有唯一的字段?)
本文介紹了SQL Server 中是否每條記錄都有唯一的字段?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

我在 Visual Studio - VB.NET 中工作.

I'm working in Visual Studio - VB.NET.

我的問題是我想刪除 SQL Server 中的特定行,但我唯一的唯一列是一個自動遞增的標(biāo)識.

My problem is that I want to delete a specific row in SQL Server but the only unique column I have is an Identity that increments automatically.

我的工作流程:
1.我在列中添加了一行(身份正在遞增,但我不知道數(shù)字)
2.我想刪除上一行

My process of work:
1. I add a row in the column (the identity is being incremented, but I don't know the number)
2. I want to delete the previous row

是否存在每條新記錄都有的唯一 ID?可能我的表有 2 條完全相同的記錄,只是序列(身份)不同.

Is there a sort of unique ID that every new record has? It's possible that my table has 2 exactly the same records, just the sequence (identity) is different.

任何想法如何處理這個問題?

Any ideas how to handle this problem?

推薦答案

SQL Server 有幾個函數(shù)可以返回最后一行的生成 ID,每個函數(shù)都有自己特定的優(yōu)點和缺點.

SQL Server has a few functions that return the generated ID for the last rows, each with it's own specific strengths and weaknesses.

基本上:

  • @@IDENTITY 如果您不使用觸發(fā)器
  • SCOPE_IDENTITY() 適用于您明確調(diào)用的代碼.
  • IDENT_CURRENT(‘tablename’) 適用于所有范圍的特定表.
  • @@IDENTITY works if you do not use triggers
  • SCOPE_IDENTITY() works for the code you explicitly called.
  • IDENT_CURRENT(‘tablename’) works for a specific table, across all scopes.

在幾乎所有情況下,SCOPE_IDENTITY() 都是您所需要的,并且使用它是一個好習(xí)慣,而不是其他選項.
此處.

In almost all scenarios SCOPE_IDENTITY() is what you need, and it's a good habit to use it, opposed to the other options.
A good discussion on the pros and cons of the approaches is also available here.

這篇關(guān)于SQL Server 中是否每條記錄都有唯一的字段?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

What SQL Server Datatype Should I Use To Store A Byte[](我應(yīng)該使用什么 SQL Server 數(shù)據(jù)類型來存儲字節(jié) [])
Interpreting type codes in sys.objects in SQL Server(解釋 SQL Server 中 sys.objects 中的類型代碼)
Typeorm .loadRelationCountAndMap returns zeros(Typeorm .loadRelationCountAndMap 返回零)
MS SQL: Should ISDATE() Return quot;1quot; when Cannot Cast as Date?(MS SQL:ISDATE() 是否應(yīng)該返回“1?什么時候不能投射為日期?)
Converting the name of a day to its integer representation(將一天的名稱轉(zhuǎn)換為其整數(shù)表示)
How to convert nvarchar m/d/yy to mm/dd/yyyy in SQL Server?(如何在 SQL Server 中將 nvarchar m/d/yy 轉(zhuǎn)換為 mm/dd/yyyy?)
主站蜘蛛池模板: 国产日韩精品视频 | 美女久久久久久久 | 成人综合久久 | 国产精品久久久久久久久久久新郎 | 久久久综合网 | 91av在线免费看 | 亚洲欧洲精品一区 | 精品一区二区三区四区 | 一区二区国产精品 | 日日综合 | 国产性网| 亚洲精品一 | 欧美电影一区 | 在线观看国产www | 欧美日韩电影一区二区 | 亚洲美女av网站 | 国产精品久久久久无码av | 一区二区在线免费观看 | 国产欧美精品 | 精品国产免费一区二区三区五区 | 日韩av在线中文字幕 | 一级黄色生活视频 | 精品日韩一区 | 337p日本欧洲亚洲大胆 | 亚洲一区二区精品视频 | 免费视频99 | 99re视频| 日本精品一区二区在线观看 | 99亚洲视频 | 亚洲欧美日韩精品久久亚洲区 | 中文字幕第十一页 | 欧美成人aaa级毛片在线视频 | 精品福利一区二区三区 | 精品国产乱码久久久久久88av | 免费毛片网站在线观看 | 亚洲一区日韩 | 99色综合| 91精品国产综合久久精品 | 一区二区三区日 | 久久久精彩视频 | 国产一区二区三区日韩 |