Showing posts with label acommit. Show all posts
Showing posts with label acommit. Show all posts

Sunday, February 19, 2012

Commit for altering column

Does altering table columns i.e chat to nchar require a
commit?...Hope it is not as it falls under DDL..
krishHi,
ALTER TABLE is a DDL statement. But you need to use COMMIT if you are doing
the ALTER Table inside a transaction
(Begin Tran .. Rollback tran .. Commit tran). This is same for CREATE ,
ALTER , DROP , TRUNCATE commands
Begin tran
alter table x_df drop constraint defaul1_cons
if @.@.error !=0
rollback tran
else
commit tran
SQL server does a autocommit if you are not using a trasnaction.
alter table x_df drop constraint defaul1_cons
Thanks
Hari
MCDBA
<anonymous@.discussions.microsoft.com> wrote in message
news:4bf101c48038$708ae050$a601280a@.phx.gbl...
> Does altering table columns i.e chat to nchar require a
> commit?...Hope it is not as it falls under DDL..
> krish|||Hi,
I am running alter scripts from a table one by one by
reading a temp tables..and it is done via a cursor..
How should i handle then, is it worth do a commit after
each statement?..Would be great if you can give your
inputs...Also would it affect performance ...
krish..

>--Original Message--
>Hi,
>ALTER TABLE is a DDL statement. But you need to use
COMMIT if you are doing
>the ALTER Table inside a transaction
>(Begin Tran .. Rollback tran .. Commit tran). This is
same for CREATE ,
>ALTER , DROP , TRUNCATE commands
>Begin tran
>alter table x_df drop constraint defaul1_cons
>if @.@.error !=0
>rollback tran
>else
>commit tran
>SQL server does a autocommit if you are not using a
trasnaction.
>alter table x_df drop constraint defaul1_cons
>Thanks
>Hari
>MCDBA
>
><anonymous@.discussions.microsoft.com> wrote in message
>news:4bf101c48038$708ae050$a601280a@.phx.gbl...
>
>.
>

Commit for altering column

Does altering table columns i.e chat to nchar require a
commit?...Hope it is not as it falls under DDL..
krish
Hi,
ALTER TABLE is a DDL statement. But you need to use COMMIT if you are doing
the ALTER Table inside a transaction
(Begin Tran .. Rollback tran .. Commit tran). This is same for CREATE ,
ALTER , DROP , TRUNCATE commands
Begin tran
alter table x_df drop constraint defaul1_cons
if @.@.error !=0
rollback tran
else
commit tran
SQL server does a autocommit if you are not using a trasnaction.
alter table x_df drop constraint defaul1_cons
Thanks
Hari
MCDBA
<anonymous@.discussions.microsoft.com> wrote in message
news:4bf101c48038$708ae050$a601280a@.phx.gbl...
> Does altering table columns i.e chat to nchar require a
> commit?...Hope it is not as it falls under DDL..
> krish
|||Hi,
I am running alter scripts from a table one by one by
reading a temp tables..and it is done via a cursor..
How should i handle then, is it worth do a commit after
each statement?..Would be great if you can give your
inputs...Also would it affect performance ...
krish..

>--Original Message--
>Hi,
>ALTER TABLE is a DDL statement. But you need to use
COMMIT if you are doing
>the ALTER Table inside a transaction
>(Begin Tran .. Rollback tran .. Commit tran). This is
same for CREATE ,
>ALTER , DROP , TRUNCATE commands
>Begin tran
>alter table x_df drop constraint defaul1_cons
>if @.@.error !=0
>rollback tran
>else
>commit tran
>SQL server does a autocommit if you are not using a
trasnaction.
>alter table x_df drop constraint defaul1_cons
>Thanks
>Hari
>MCDBA
>
><anonymous@.discussions.microsoft.com> wrote in message
>news:4bf101c48038$708ae050$a601280a@.phx.gbl...
>
>.
>