Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Generating Script using Enterprise manager

Author  Topic 

anuradhay
Starting Member

41 Posts

Posted - 2005-05-19 : 05:29:50
When i try to generate script using enterprise manager, i am getting the [],collate sequence etc.. is there any way to ignore these while generating the script?
existing one
CREATE TABLE [dbo].[class] (
[class_id] [tinyint] NOT NULL ,
[class_name] [varchar] (20) COLLATE SQL_Latin1_General_CP850_CI_AS NOT NULL ,
[class_login] [varchar] (5) COLLATE SQL_Latin1_General_CP850_CI_AS NOT NULL ,
[status_id] [tinyint] NULL ,
[last_mod_date] [datetime] NULL ,
[last_mod_by] [t_usr_id] NULL
) ON [PRIMARY]
GO
i want to remove the [], on primary etc.., collate sequence, while taking the script. is it possible?

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2005-05-19 : 05:42:15
Not that i know of

You could copy it to your clip board using the PREVIEW option
Paste into QA or Notepad and do a find and replace then save as .sql file

Andy

Beauty is in the eyes of the beerholder
Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2005-05-19 : 06:25:56
On the Formatting tab, select "Only script 7.0 compatible features".
That stops the collation for every column being scripted with the table definition.
Best to check for any unwanted side-effects.

Then, as above, find and replace the square brackets in a text editor.
Go to Top of Page

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2005-05-19 : 06:59:20
I wouldnt recommend doing that though you could run into a lot of problems

Two that it wouldnt script by selecting that option are UDF's, INSTEAD OF and AFTER TRIGGERS

Andy


Beauty is in the eyes of the beerholder
Go to Top of Page

ruan4u
Posting Yak Master

132 Posts

Posted - 2005-05-19 : 09:18:24
COLLATE SQL_Latin1_General_CP850_CI - What are these collate and are they needed as a part of table generation/alter scripts ?
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-05-19 : 18:55:16
I can't for the life of me understand why people do this. The scripts generated by EM look awful and are difficult to read. Hence the genesis of your question.

Why not just write the script for the objects yourself in Query Analyzer and then save them in your source code control system.

BTW, if you absolutely insist on creating your objects in EM, there are more and better formatting options available to you in Query Analyzer. Look in Tools-Option-Script tab. Specifically, there is an option to turn off the square brackets.

HTH

=================================================================
The surest way to corrupt a youth is to instruct him to hold in higher esteem those who think alike than those who think differently. -Friedrich Nietzsche, philosopher (1844-1900)

Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-05-19 : 20:28:14
Go into Query Analyzer/Tools/Option/Script/"Do not script the collation clause if source is an instance of SQL Server version 7.0 or later".

This will stop the collation clauses from being added in both Query Analyzer and Enterprise Manager without causing the problems changing "Only script 7.0 compatible features" will cause.

Ruan, you can look up code page and collations in Books Online.



MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -