Re: Add a coulm in a table, after a specific column
- From: "D." <d@xxxxx>
- Date: Mon, 5 Nov 2007 14:28:54 +0100
o Transsaction scope. The script has many small transactions, but there
should be one big transaction. That or just restore a backup if there
is any error.
Ok, I have to execute the DDL statements via jdbc so Iìll put them inside a
unique transaction.
o Constraints are restored with NOCHECK, that should be WITH CHECK.
That takes longer time, but the flip side is that the optimiser then
can trust the constraints. This can matter a lot in some cases.
Ok
o Remove all "go" in the script, and wrap most statements in EXEC.
The way script lookas as generated, if there is a batch-aborting
error, the transaction is rolled back, and the rest of the statements
will be committed. An alternative is to wrap all batches in
IF @@transcount > 0 BEGIN END.
I must remove all "go" statements because I'll execute the code via jdbc
driver.
I've not understood what do you mean with the phrase "wrap most statements
in EXEC" (sorry but I'm fairly new to SQLServer)
o Rewiew that the script only includes the changes you intend. There
are situations where EM/SSMS may include a change that you have
abandoned.
Ok, I'll do.
I' also noticed that SSMS, before the ALTER TABLE statement put always some
instructions (in the automated generated SQL) that I don't unserstand
well...
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE xxxxxxx
Do you think that I have to execute them from my java program or can I start
directly with ALTER TABLE instruction?
Thanks,
D.
.
- Follow-Ups:
- Re: Add a coulm in a table, after a specific column
- From: Erland Sommarskog
- Re: Add a coulm in a table, after a specific column
- References:
- Re: Add a coulm in a table, after a specific column
- From: D.
- Re: Add a coulm in a table, after a specific column
- From: Erland Sommarskog
- Re: Add a coulm in a table, after a specific column
- Prev by Date: Re: sql dump
- Next by Date: Suggestions
- Previous by thread: Re: Add a coulm in a table, after a specific column
- Next by thread: Re: Add a coulm in a table, after a specific column
- Index(es):
Relevant Pages
|