简体   繁体   English

在SQLServer Compact中返回Identity

[英]return Identity in SQLServer Compact

在SQL Server Compact 3.5中插入后如何获取标识列值?

I think what you want is @@IDENTITY: 我认为您想要的是@@ IDENTITY:

SELECT @@IDENTITY AS Identity

This will return the value of the last identity inserted. 这将返回最后插入的身份的值。

I guess you have to use @@IDENTITY . 我猜你必须使用@@ IDENTITY I figured compact would have SCOPE_IDENTITY() , but I guess not. 我认为compact将具有SCOPE_IDENTITY() ,但我想没有。 Just try scope_identity to be sure. 只需尝试scope_identity即可。 :) :)

我用

SELECT MAX(<IdentityColumn>) FROM <TableName>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft SQL Server Compact Edition插入查询返回选择@@ identity - Microsoft SQL Server Compact edition insert query return select @@identity 使用Microsoft.SqlServer.Smo更改列标识 - Alter column identity with Microsoft.SqlServer.Smo 身份成员不支持类型“Microsoft.SqlServer.Types.SqlHierarchyId” - Type 'Microsoft.SqlServer.Types.SqlHierarchyId' is not supported for identity members SQL Compact,新数据集,标识列的顺序相反并且没有提交? - SQL Compact, new DataSet, identity column in reverse order and no commit? 使用 LINQPad 将实体插入 SQL Compact 4 Table with Identity 列 - Inserting Entity into SQL Compact 4 Table with Identity column using LINQPad 在带有实体框架 6.4 的 SQL 服务器紧凑型中无法使用 IDENTITY_INSERT - Not working IDENTITY_INSERT in SQL Server Compact with Entity Framework 6.4 我可以将2个不同的EntityFramework上下文共享一个SqlServer Compact数据库吗? - Can I have 2 different EntityFramework contexts share a single SqlServer Compact database? 返回SQL Server Compact中的列列表 - Return List of Columns in SQL Server Compact @@ identity是否返回主键或标识字段? - Does @@identity return the primary key or identity field? C#在插入时返回身份 - C# return Identity on Insert
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM