目标:
在表中插入值
问题:
不知道怎么做
的信息:
*您只能添加一个新地址和邮政编码
*请注意,它可能是大量数据!
CREATE TABLE [AddressBook]
(
[testID] [uniqueidentifier] NOT NULL default newid(),
[address] [nvarchar](50) NULL,
[zipcode] [nvarchar](50) NULL
)
答案 0 :(得分:0)
您可以通过插入存储过程检索插入的GUID,如此示例:
CREATE PROCEDURE [dbo].[spUpdateBookmark]
@BookmarkGuid [uniqueidentifier] = null,
@otherfield nvarchar(256),
@NewBookmarkGuid [uniqueidentifier] OUTPUT
WITH EXECUTE AS CALLER
AS
BEGIN
SET @BookmarkGuid = NewID()
INSERT INTO Bookmarks
(BookmarkGuid,
otherfield)
Values
(@BookmarkGuid,
@otherfield)
SET @NewBookmarkGuid = @BookmarkGuid
END
然后,当您调用该过程时,您将为输出值添加一个参数。