I am trying to pass a tablename as a parameter. Below is the code I have and it is giving me an error
CREATE PROCEDURE [dbo].[pcs_DeleteOldPAFiles]
@upltable nvarchar(50)
AS
BEGIN
Declare @startdate datetime
SET @startdate = CONVERT(nvarchar, getdate(), 101)
Delete * from @upltable
Where [Date of Last Change] < @startdate-6
END
Error: Incorrect syntax near '*'.
What am I doing wrong..
CREATE PROCEDURE [dbo].[pcs_DeleteOldPAFiles]
@upltable nvarchar(50)
AS
BEGIN
Declare @startdate datetime
SET @startdate = CONVERT(nvarchar, getdate(), 101)
Delete * from @upltable
Where [Date of Last Change] < @startdate-6
END
Error: Incorrect syntax near '*'.
What am I doing wrong..