Eliminar Dados no SQL Server 7

10/06/2004

0

Pessoal,

Tenho uma tabela em SQL Server 7, com autoencremento, gostaria de saber como eu faço para começar a tabela do zero, inclusive o AutoIncremento começando do 1 e assim sucessivamente

Alguém tem alguma dica

Um abraço a todos

Luiz


Camargo

Camargo

Responder

Posts

10/06/2004

Fer_nanda

Gere um script da tabela, dê um drop nela e depois execute o script dela novamente.


Responder

12/07/2004

Marcus.magalhaes

Camargo, boa noite.

Utilize o seguinte comando :
DBCC CHECKIDENT
Checks the current identity value for the specified table and, if needed, corrects the identity value.

Syntax
DBCC CHECKIDENT
( ´table_name´
[ , { NORESEED
| { RESEED [ , new_reseed_value ] }
}
]
)

Arguments
´table_name´

Is the name of the table for which to check the current identity value. Table names must conform to the rules for identifiers. For more information, see Using Identifiers. The table specified must contain an identity column.

NORESEED

Specifies that the current identity value should not be corrected.

RESEED

Specifies that the current identity value should be corrected.

new_reseed_value

Is the value to use in reseeding the identity column.


Ex. :
DBCC CHECKIDENT (teste, RESEED, 1)


Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar