A one-liner for this does not exist in SQL Server. If you don't have any referential integrity, you may issue the following little piece of code:
set @sql = '';
@sql = @sql + 'truncate table ['+ss.name+'].['+so.name+']'+char(13)+char(10)
sys.schemas ss on
ss.schema_id = so.schema_id
so.type = 'U'
exec sp_executesql @sql;
If you have referential integrity, you can either run it until it does not return any error, or you may alter the code to issue the truncation in the correct order. But as I said, out of the box there is no such thing as a one liner for truncating all tables, and thank God for that, I can clearly see the frustration of someone with too much privileges that just have wiped out the entire database.
how to use d tranct option for all tables at a time in single reason thanks for helping
How did you knew the question was about the use of TRUNCATE? The best I could interpret this question, was it had something to do with a giant transaction to be performed on all tables of a database. But I wasn't even sure about the correctness of that interpretation.
English is not my native language, is that the reason why I failed where you succeeded? But nor is English the native tongue of Roac ...
Anyway, you guys are Gods! Err ... angels.
With kind regards . . . . . SQL Server 2000/2005/2012
Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2. Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages
English is definitely not my native language, and I could not know whether he asked about a huge transaction or truncation, but: Transactions are in fact held for all tables being accessed, and it seemed plausible that someone would ask how to truncate all the tables in a database. It would actually be a nice feature when debugging data load