SQLSMS problema

10/09/2009

0

Oi,

Eu tenho uma BD em que as tabelas estão definidas em scripts. Eu gostava de saber como posso gerar as tabelas no Microsoft SQL Server Management Studio 2008?? é que não tem sentido estar a introduzir as tabelas campo a campo quando tenho o script,

agradeço muito a vossa ajuda,

MP

Exemplo de um extracto de script:

use DDS
go

-- Drop FK if exists:

if exists
(select * from sys.foreign_keys
where name = ´fk_fact_campaign_result_dim_customer´
and parent_object_id = object_id(´fact_campaign_result´))
alter table fact_campaign_result
drop constraint fk_fact_campaign_result_dim_customer
go

if exists
(select * from sys.foreign_keys
where name = ´fk_fact_communication_subscription_dim_customer´
and parent_object_id = object_id(´fact_communication_subscription´))
alter table fact_communication_subscription
drop constraint fk_fact_communication_subscription_dim_customer
go

if exists
(select * from sys.foreign_keys
where name = ´fk_fact_subscription_sales_dim_customer´
and parent_object_id = object_id(´fact_subscription_sales´))
alter table fact_subscription_sales
drop constraint fk_fact_subscription_sales_dim_customer
go

if exists
(select * from sys.foreign_keys
where name = ´fk_fact_product_sales_dim_customer´
and parent_object_id = object_id(´fact_product_sales´))
alter table fact_product_sales
drop constraint fk_fact_product_sales_dim_customer
go

-- Drop and create the table:

if exists
(select * from sys.tables
where name = ´dim_customer´)
drop table dim_customer
go

create table dim_customer
( customer_key int not null
, customer_id varchar(10) not null
, account_number int
, customer_type char(3)
, name varchar(100)
, gender char(1)
, email_address varchar(200)
, date_of_birth datetime
, address1 varchar(50)
, address2 varchar(50)
, address3 varchar(50)
, address4 varchar(50)
....


Marcop

Marcop

Responder

Posts

11/09/2009

Renato Tavares

Olá..!! 8)

Não sei se é isso, porém pelo o que eu entendi é o seguinte: :D

Crie uma nova Database e depois abra uma ´new query´ e execute seus scripts dentro da sua nova DataBase. :wink:


Responder

11/09/2009

Renato Tavares

Olá..!! 8)

Não sei se é isso, porém pelo o que eu entendi é o seguinte: :D

Crie uma nova Database e depois abra uma ´new query´ e execute seus scripts dentro da sua nova DataBase. :wink:


Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar