Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: MOD Implementation
 mod_dbsetup syntax
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Aznknight
Senior Member

USA
1373 Posts

Posted - 26 April 2001 :  13:30:53  Show Profile  Send Aznknight an AOL message  Send Aznknight an ICQ Message
I've been looking for huwr's explanation and example of mod_dbsetup but i can't seem to find it. I'm looking for the syntax to alter an existing table

I'm trying to add two columns to my LINKS table setup: RATING and VOTES
I want both to be int not null with the default value of 0.

and here's what I'm trying but i guess it doesn't work.

[ALTER]
LINKS
ADD
RATING#int##0#
VOTES#int##0#
[END]


Also I would like to someway make the existing link to have 0 entered.
something equivalent to
UPDATE LINKS SET RATING = 0, VOTES = 0 WHERE RATING = ""


- Alan
www.iamviet.com
www.calvsa.net
Snitz Resource

Aznknight
Senior Member

USA
1373 Posts

Posted - 26 April 2001 :  13:38:21  Show Profile  Send Aznknight an AOL message  Send Aznknight an ICQ Message
ahh more messing around with it and i got it. Look liked Huwr thought about the update issue as well. Well done

Here's the correcnt syntax
[ALTER]
LINKS
ADD#RATING#int##0#
[END]
[ALTER]
LINKS
ADD#VOTES#int##0#
[END]

And here's what the mod_dbsetup output

--------------------------------------------------------------------------------

Adding Column...
ALTER TABLE LINKS ADD COLUMN RATING int NOT NULL DEFAULT 0
Column added successfully
Populating Current Records with new Default value
UPDATE LINKS SET RATING=0
Table(s) updated

--------------------------------------------------------------------------------

Adding Column...
ALTER TABLE LINKS ADD COLUMN VOTES int NOT NULL DEFAULT 0
Column added successfully
Populating Current Records with new Default value
UPDATE LINKS SET VOTES=0
Table(s) updated

Cool



- Alan
www.iamviet.com
www.calvsa.net
Snitz Resource
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 26 April 2001 :  14:46:42  Show Profile  Visit HuwR's Homepage
yes I did, since adding a new column does not always populate with a default un less you set the column to NOT NULL, then it populates automatically.

I am about to stick a post in DEv team forum, asking all MOD writers to send me there dbs files, so I can make sure they are all compatible with the latest version. I will repost the instructions, but you can see them here www.magicmushroom.org.uk there should be a link in the top 5 links list

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.35 seconds. Powered By: Snitz Forums 2000 Version 3.4.07