Click here to Skip to main content
15,921,660 members
Home / Discussions / Database
   

Database

 
AnswerRe: which way i should go ? Pin
SimonS27-Jun-03 20:40
SimonS27-Jun-03 20:40 
GeneralADO Pin
AticAtac25-Jun-03 5:11
AticAtac25-Jun-03 5:11 
GeneralWHERE CLAUSE problem. Pin
Asim N.25-Jun-03 2:22
Asim N.25-Jun-03 2:22 
GeneralRe: WHERE CLAUSE problem. Pin
basementman25-Jun-03 4:36
basementman25-Jun-03 4:36 
GeneralConnection is busy with results of another command Pin
audio-video24-Jun-03 21:48
audio-video24-Jun-03 21:48 
GeneralCode Database Help; Pin
Bo Hunter23-Jun-03 10:46
Bo Hunter23-Jun-03 10:46 
GeneralRe: Code Database Help; Pin
Ray Cassick23-Jun-03 11:03
Ray Cassick23-Jun-03 11:03 
GeneralRe: Code Database Help; Pin
basementman24-Jun-03 5:04
basementman24-Jun-03 5:04 
Here are some table layouts we use for a hierarchial "file system" that is browsed via a tree in a web browser:

create table ic_DocumentCategory
(
DocumentCategoryKey int NOT NULL IDENTITY,
CompanyKey int NOT NULL,
Description varchar(80) NOT NULL,
VisibleToInternalUsers bit NOT NULL,
VisibleToExternalUsers bit NOT NULL
)
GO
create unique clustered index ic_DocumentCategoryDesc_idx
on ic_DocumentCategory (CompanyKey, Description)
create unique index ic_DocumentCategory_idx on ic_DocumentCategory (DocumentCategoryKey)
GO



create table ic_DocumentFolder
(
DocumentFolderKey int NOT NULL IDENTITY,
DocumentCategoryKey int NOT NULL,
ParentFolderKey int NULL,
Description varchar(80) NOT NULL,
OwnerInternalUserKey int NULL,
VisibleToInternalUsers bit NOT NULL,
VisibleToExternalUsers bit NOT NULL
)
GO

create unique clustered index ic_DocumentFolderCatParentDesc_idx
on ic_DocumentFolder (DocumentCategoryKey, ParentFolderKey, Description)
create unique index ic_DocumentFolderKeyDesc_idx
on ic_DocumentFolder (DocumentFolderKey, Description)
create unique index ic_DocumentFolderParentDesc_idx
on ic_DocumentFolder (ParentFolderKey, Description, DocumentCategoryKey)
GO

create table ic_DocumentFolderAccess
(
  DocumentFolderAccessKey int            NOT NULL IDENTITY,
  DocumentFolderKey       int            NOT NULL,
  CompanyKey              int            NULL,
  CompanyUserKey          int            NULL,
  RoleKey                 int            NULL
)
GO
create unique clustered index ic_DocumentFolderAccessFolder_idx
  on ic_DocumentFolderAccess (DocumentFolderKey, DocumentFolderAccessKey)
create unique index ic_DocumentFolderAccess_idx
  on ic_DocumentFolderAccess (DocumentFolderAccessKey)
GO



create table ic_DocumentFolderFile
(
  DocumentFolderKey       int            NOT NULL,
  AttachmentKey           int            NOT NULL,
  CompanyUserKey         int            NOT NULL
)
GO
create unique clustered index ic_DocumentFolderFile_idx
  on ic_DocumentFolderFile (AttachmentKey, DocumentFolderKey, CompanyUserKey)
create unique index ic_DocumentFolderFileFolderAttach_idx
  on ic_DocumentFolderFile (DocumentFolderKey, AttachmentKey, CompanyUserKey)
create unique index ic_DocumentFolderFileUserFolderFile_idx
  on ic_DocumentFolderFile (CompanyUserKey, AttachmentKey, DocumentFolderKey)
GO


This syntax is for MS SQL7 or higher. Hope it gives you some ideas...


 onwards and upwards... 
GeneralTimeout expired. Pin
meaya22-Jun-03 21:34
meaya22-Jun-03 21:34 
Generalslow ODBC connections with Win 2000 Server Pin
jpeg22-Jun-03 21:25
jpeg22-Jun-03 21:25 
GeneralRe: slow ODBC connections with Win 2000 Server Pin
basementman23-Jun-03 4:09
basementman23-Jun-03 4:09 
GeneralRe: slow ODBC connections with Win 2000 Server Pin
jpeg23-Jun-03 20:54
jpeg23-Jun-03 20:54 
GeneralRe: slow ODBC connections with Win 2000 Server Pin
basementman24-Jun-03 5:09
basementman24-Jun-03 5:09 
GeneralExiting loop before it finishes causes program to crash.. Pin
IrishSonic22-Jun-03 6:43
IrishSonic22-Jun-03 6:43 
GeneralRe: Exiting loop before it finishes causes program to crash.. Pin
Nick Parker22-Jun-03 6:54
protectorNick Parker22-Jun-03 6:54 
GeneralRe: Exiting loop before it finishes causes program to crash.. Pin
IrishSonic23-Jun-03 11:24
IrishSonic23-Jun-03 11:24 
GeneralStoring Class(Object) in a SQL Database (C#) Pin
Daniel Kirstenpfad21-Jun-03 3:54
Daniel Kirstenpfad21-Jun-03 3:54 
Questionhow to generalize SQL queries Pin
puppiesLover20-Jun-03 8:04
puppiesLover20-Jun-03 8:04 
AnswerRe: how to generalize SQL queries Pin
Mike Osbahr23-Jun-03 4:48
Mike Osbahr23-Jun-03 4:48 
GeneralAdd host to MySQL 4 Pin
Matt Newman19-Jun-03 7:16
Matt Newman19-Jun-03 7:16 
GeneralRe: Add host to MySQL 4 Pin
ZoogieZork22-Jun-03 7:19
ZoogieZork22-Jun-03 7:19 
GeneralPopulate schema to database Pin
Jim Stewart19-Jun-03 6:59
Jim Stewart19-Jun-03 6:59 
GeneralCreateDatabase Pin
Jim Stewart19-Jun-03 6:50
Jim Stewart19-Jun-03 6:50 
GeneralRe: CreateDatabase Pin
Joshua Nussbaum27-Jun-03 8:51
Joshua Nussbaum27-Jun-03 8:51 
GeneralTransactions Pin
Megan Forbes19-Jun-03 5:03
Megan Forbes19-Jun-03 5:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.