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)
 Generate Scripts of Object in SQLServer2k

Author  Topic 

smhjm
Starting Member

3 Posts

Posted - 2005-12-25 : 05:53:40
Hi my friend
I want Generate the script of my table but when in normal form doing this sqlserver generate my script with [dbo].nameOfObject
for example:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_EOSBuOfficeUnitT_EOSBuUnitT]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[EOSBuOfficeUnitT] DROP CONSTRAINT FK_EOSBuOfficeUnitT_EOSBuUnitT
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EOSBuUnitT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[EOSBuUnitT]
GO

CREATE TABLE [dbo].[EOSBuUnitT] (
[UnID] [int] IDENTITY (1, 1) NOT NULL ,
[ModuleID] [int] NULL ,
[UnName] [nvarchar] (100) COLLATE Arabic_CI_AS NULL ,
[UnManager] [nvarchar] (100) COLLATE Arabic_CI_AS NULL ,
[UnParent] [nvarchar] (50) COLLATE Arabic_CI_AS NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[EOSBuUnitT] WITH NOCHECK ADD
CONSTRAINT [PK_Unit] PRIMARY KEY CLUSTERED
(
[UnID]
) ON [PRIMARY]
GO

but i want generate my Scrip with replace [dbo.] with {DataBaseOwner}
and i don't know where is {ObjectQulifier}
can you help to me that generate my script with this name
for example:
if exists (select * from dbo.sysobjects where id = object_id(N'{DataBaseOwner}{ObjectQulifier}EOSBuUnitT') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table {DataBaseOwner}{ObjectQulifier}EOSBuUnitT
GO


afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-12-25 : 13:27:40
hello,
Why not EM generate the script for you, then you can choose to alter what you desire

Afrika
Go to Top of Page
   

- Advertisement -