Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can trunc table statement be used in Store Proc?

Status
Not open for further replies.

6656

Programmer
Nov 5, 2002
104
0
0
US
Hi all,

The truncate table command is written to a store procedure. However, bellow Error message came out.
"TRUNCATE TABLE command not allowed within multi-statement transaction."

Plz give some example to fix the erro.

bellow option was set before run my store proc.

sp_dboption mydb, "ddl in tran", true
go
used mydb
go
CHECKPOINT
goe

Thank,
Mike

 
I was able to truncate a table in a stored procedure using the following:

Code:
     EXECUTE IMMEDIATE
        'TRUNCATE TABLE tablename ';';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top