Segue um script que me tem sido muito útil quando estou testando e desenvolvendo um novo projeto de banco de dados. Ele tem um único objetivo: excluir todos os registros de todas as tabelas de uma determinada base. Basta você alterar o comando USE
, de modo a apontar para o banco que você deseja. Apenas um detalhe: este script considera apenas o uso do esquema DBO
. Portanto, se sua base utiliza outros esquemas, além do DBO
, então você precisará ajustar.
[et_pb_dmb_code_snippet _builder_version=”4.0.6″ code=”dXNlIERCVGVzdApHTwpTRVQgTk9DT1VOVCBPTjsKREVDTEFSRSBAc3FsIHZhcmNoYXIoNDAwMCk7Ci0tIDAgLSBSZWN1cGVyYXIgYSBsaXN0YSBkZSBjb25zdHJhaW50cwpERUNMQVJFIEB0YmwgVGFibGUgKCB0YWJlbGEgdmFyY2hhcig1MDApLCByZXN0cmljYW8gdmFyY2hhcig1MDApICk7Ci0tIDEgLSBEZXNhYmlsaXRhciBjb25zdHJhaW50cwppbnNlcnQgSU5UTyBAdGJsClNFTEVDVAogICAgdC5uYW1lLCBrLm5hbWUKRlJPTSBzeXMuZm9yZWlnbl9rZXlzIGsKSk9JTiBzeXMudGFibGVzIHQgT04gay5wYXJlbnRfb2JqZWN0X2lkID0gdC5vYmplY3RfaWQ7CldISUxFIChzZWxlY3QgY291bnQoKikgZnJvbSBAdGJsKSA+IDAKYmVnaW4KIHNlbGVjdCB0b3AgMSBAc3FsID0gJ0FMVEVSIFRBQkxFIGRiby4nICsgdC50YWJlbGEgKyAnIG5vY2hlY2sgY29uc3RyYWludCAnICsgdC5yZXN0cmljYW8gKyAnOycKICAgIGZyb20gQHRibCB0OwogZGVsZXRlIFRPUCgxKSBGUk9NIEB0Ymw7CiBFWEVDKEBzcWwpOwpFTkQ7ICAgCi0tIDIgLSBUcnVuY2FyCkVYRUMgc3lzLnNwX01TZm9yZWFjaHRhYmxlICdERUxFVEUgRlJPTSA/JzsKLS0gMyAtIFJlYWJpbGl0YSBhcyBjb25zdHJhaW50cwppbnNlcnQgSU5UTyBAdGJsClNFTEVDVAogICAgdC5uYW1lLC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