标签:cts exist 执行存储过程 te pro sys data span object_id fir
比如你有一个存储过程
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N‘[dbo].[CreateAuthor]‘) AND type in (N‘P‘, N‘PC‘)) BEGIN EXEC dbo.sp_executesql @statement = N‘ CREATE PROCEDURE [dbo].[CreateAuthor] @FirstName Varchar(50), @LastName Varchar(50), @Address Varchar(100) AS INSERT INTO dbo.Authors( [FirstName], [LastName], [Address] ) VALUES (@FirstName, @LastName, @Address) ‘
using (var context = new BookStore()) { int affectedRows = context.Database.ExecuteSqlCommand("CreateAuthor @p0, @p1, @p2", parameters: new[] { "Mark", "Cuban", "23 Tsawassen Blvd." }); }
标签:cts exist 执行存储过程 te pro sys data span object_id fir
原文地址:https://www.cnblogs.com/nocanstillbb/p/11495002.html