Home > Archive > Microsoft SQL Server forum > July 2005 > why do generated script begin with empty transactions ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author why do generated script begin with empty transactions ?
gabriel

2005-07-29, 7:23 am

Greetings,

I am adding foreign keys to a database and saving the generated scripts.

What I do not understand is that all script begin with empty
transactions. Why ?

Example follows :
/*

vendredi 29 juillet 2005 10:54:36

User:

Server: (LOCAL)

Database: NewsPaper

Application: MS SQLEM - Data Tools

*/



BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_N
ULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
COMMIT
BEGIN TRANSACTION
COMMIT
BEGIN TRANSACTION
COMMIT
BEGIN TRANSACTION
COMMIT
BEGIN TRANSACTION
COMMIT
BEGIN TRANSACTION
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.Article ADD CONSTRAINT
FK_Article_Publicati
onLevel FOREIGN KEY
(
PublicationLevelId
) REFERENCES dbo.PublicationLevel
(
PublicationLevelId
) ON UPDATE CASCADE
ON DELETE CASCADE

GO
ALTER TABLE dbo.Article ADD CONSTRAINT
FK_Article_UserInfo FOREIGN KEY
(
CreatorId
) REFERENCES dbo.UserInfo
(
UserId
) ON UPDATE CASCADE
ON DELETE CASCADE

GO
ROLLBACK
Simon Hayes

2005-07-29, 9:23 am


"gabriel" <spam@yahoo.fr> wrote in message
news:42e9f0e9$0$5298
$636a15ce@news.free.fr...
> Greetings,
>
> I am adding foreign keys to a database and saving the generated scripts.
>
> What I do not understand is that all script begin with empty transactions.
> Why ?
>
> Example follows :
> /*
>
> vendredi 29 juillet 2005 10:54:36
>
> User:
>
> Server: (LOCAL)
>
> Database: NewsPaper
>
> Application: MS SQLEM - Data Tools
>
> */
>
>
>
> BEGIN TRANSACTION
> SET QUOTED_IDENTIFIER ON
> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
> SET ARITHABORT ON
> SET NUMERIC_ROUNDABORT OFF
> SET CONCAT_NULL_YIELDS_N
ULL ON
> SET ANSI_NULLS ON
> SET ANSI_PADDING ON
> SET ANSI_WARNINGS ON
> COMMIT
> BEGIN TRANSACTION
> COMMIT
> BEGIN TRANSACTION
> COMMIT
> BEGIN TRANSACTION
> COMMIT
> BEGIN TRANSACTION
> COMMIT
> BEGIN TRANSACTION
> COMMIT
> BEGIN TRANSACTION
> COMMIT
> BEGIN TRANSACTION
> ALTER TABLE dbo.Article ADD CONSTRAINT
> FK_Article_Publicati
onLevel FOREIGN KEY
> (
> PublicationLevelId
> ) REFERENCES dbo.PublicationLevel
> (
> PublicationLevelId
> ) ON UPDATE CASCADE
> ON DELETE CASCADE
>
> GO
> ALTER TABLE dbo.Article ADD CONSTRAINT
> FK_Article_UserInfo FOREIGN KEY
> (
> CreatorId
> ) REFERENCES dbo.UserInfo
> (
> UserId
> ) ON UPDATE CASCADE
> ON DELETE CASCADE
>
> GO
> ROLLBACK


It looks like you're using the Table Designer in EM? I have no idea why the
script includes those statements, but in general it's much better to make
DDL changes using a script in Query Analyzer - EM is useful for admin tasks,
but it's not very suitable for design and programming tasks (in fact, some
tasks cannot be done at all in EM). This article gives more details:

http://www.aspfaq.com/show.asp?id=2455

Simon


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com