|
Posted by Simon Hayes on 07/29/05 17:55
"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_NULL 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_PublicationLevel 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
Navigation:
[Reply to this message]
|