dbTalk Databases Forums  

Setting up a Settings Table

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Setting up a Settings Table in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Setting up a Settings Table - 05-09-2006 , 12:57 PM






I am creating an image gallery system, where there is an admin and
multiple users upload images. Each user is restricted to uploading 8
images. Currently, I have this hard coded into a trigger. I would
like it to use a table field instead... one that the admin can change
on the fly. I want to call this table Settings, but I want to create
insert 1 record, and then block all subsequent INSERT statements
(there's only going to be 1 setting) so that the Settings table will
only have 1 record in it for its entire lifetime. What's the best way
to do this?


Reply With Quote
  #2  
Old   
Razvan Socol
 
Posts: n/a

Default Re: Setting up a Settings Table - 05-09-2006 , 01:32 PM






I would create a table like this:

CREATE TABLE Settings (
DummyID tinyint DEFAULT (1) PRIMARY KEY CHECK (DummyID=1),
MaximumImages int NULL DEFAULT (8)
-- ... and other settings when needed
)

INSERT INTO Settings DEFAULT VALUES

Razvan


Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: Setting up a Settings Table - 05-09-2006 , 01:59 PM



Thanks.

Razvan Socol wrote:
Quote:
I would create a table like this:

CREATE TABLE Settings (
DummyID tinyint DEFAULT (1) PRIMARY KEY CHECK (DummyID=1),
MaximumImages int NULL DEFAULT (8)
-- ... and other settings when needed
)

INSERT INTO Settings DEFAULT VALUES

Razvan


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.