我这样做时没有出现任何错误,但它在我的数据库中创建了一个名为"dbo.@ tablename"的表,当我真正想要它创建我作为exec过程中的参数传递的值时表名.我究竟做错了什么.这是我的更新程序脚本.也许我可以改变,以便它确实创建值作为表名.
这是我到目前为止:
ALTER PROCEDURE [dbo].[Load_Negatives]
-- Add the parameters for the stored procedure here
@TABLENAME SYSNAME,
@AuditPeriodStartDate datetime,
@AuditPeriodEndDate datetime
AS
BEGIN
SET NOCOUNT ON;
Select
Location,
Customer,
Transaction_date
into
dbo.[@TABLENAME]
from dbo.CustomerHistory (nolock)
where
[Transaction_date] between @AuditPeriodStartDate and @AuditPeriodEndDate
END
Run Code Online (Sandbox Code Playgroud)