开发者

EXECUTE AS on truncate sproc - Incorrect syntax

开发者 https://www.devze.com 2023-04-09 07:10 出处:网络
I\'m getting an Incorrect syntax when trying to create a stored procedure to truncate a table then reseed it.Here\'s m开发者_运维技巧y code

I'm getting an Incorrect syntax when trying to create a stored procedure to truncate a table then reseed it. Here's m开发者_运维技巧y code

    CREATE PROCEDURE [dbo].[_TransportZipporah_Purge]

WITH EXECUTE AS owner
AS
TRUNCATE TABLE [dbo].[*tablename*];
GO
 DBCC CHECKIDENT ('dbo.*tablename*', RESEED, 0);

As i have got this direct from MSDN I would have thought it would be correct.

Database server i'm using is : SQL Server 2008 v10.0.4064.0

Can anyone help please? Thanks in advance Scott


The syntax is correct - but you cannot have a GO statement inside a proc.

0

精彩评论

暂无评论...
验证码 换一张
取 消