June 11, 2012 at 8:01 pm
Hi, for some reason I can create the table but the foreign key references are not there.
This is the script:
-- Dimension Product
CREATE TABLE dimProduct (
productId int,
productName varchar (40),
categoryName varchar (15),
unitPrice money,
primary key (productID)
)
-- Dimension Employee
CREATE TABLE dimEmployee (
employeeId int,
Name varchar (20),
city varchar (15),
region varchar (15),
country varchar (15),
primary key (employeeID)
)
-- Dimension Client
CREATE TABLE dimClient (
clientId varchar(10),
Name varchar (40),
primary key (clientId)
)
CREATE TABLE SalesFact (
clientId varchar(10),
productId int,
employeeId int,
unitPrice varchar (10),
quantity varchar (10),
discount varchar (5),
foreign key (clientId)references dimClient(clientId),
foreign key (productId) references dimProduct(productId),
foreign key (employeeId)references dimEmployee(employeeId)
)
the foreign keys of SalesFact r just not there O.o
June 12, 2012 at 2:13 am
I've just run the script and it executes and shows the foreign keys under the table ok.
What permissions do you have to the databases, SA? dbo? ddladmin?
Can you see the tables?
June 12, 2012 at 6:14 am
Maybe you need to do a refresh of the Object Explorer?
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
June 12, 2012 at 6:16 am
maybe you are scripting the table in SSMS, and it doesn't show the foreign keys because the scripting option for that is False instead of True?
Lowell
June 12, 2012 at 6:47 am
Is dbo.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply