ASP Free Lounge
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherASP Free Lounge

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 5th, 2007, 04:27 AM
DavieCooper's Avatar
DavieCooper DavieCooper is offline
I Need More Tax Money, k?
ASP Free Novice (500 - 999 posts)
 
Join Date: Oct 2006
Location: Londonderry/Oxfordshire
Posts: 567 DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 32 m 35 sec
Reputation Power: 24
PostgreSQL Help

Hey guys,

Wasn't sure if this belonged in any of the DB sections (I know there is an SQL, but this is different I think). So if somebody could let me know for future reference then great

I am trying to do a simple store procedure to add a colum and 2 rows of data to a DB.

DB Name: TestDatabase
Schema: TestSchema
Table: TestTable

ALTER TABLE TestTable ADD COLUMN Numbers VARCHAR(30);
INSERT INTO TestTable VALUES (1, 2);

At the minute it is to just have numbers in it. From what I have done for myself can anybody let me know if it will create a column called 'Numbers' and add a row with '1' and then a second with '2' as the data?

Cheers guys,

Davie
__________________
If I have helped please click the scales


Aye big mawn, I'm frum Norn Iron heigh

Reply With Quote
  #2  
Old January 5th, 2007, 08:37 AM
chapman10s's Avatar
chapman10s chapman10s is offline
**Wanted Wizard**
ASP Free God (5000 - 5499 posts)
 
Join Date: Apr 2006
Location: Who knows...
Posts: 5,410 chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)chapman10s User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 12139 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 4 Days 12 h 36 m
Reputation Power: 1331
Send a message via AIM to chapman10s Send a message via MSN to chapman10s
Quote:
Originally Posted by DavieCooper
Hey guys,

Wasn't sure if this belonged in any of the DB sections (I know there is an SQL, but this is different I think). So if somebody could let me know for future reference then great

I am trying to do a simple store procedure to add a colum and 2 rows of data to a DB.

DB Name: TestDatabase
Schema: TestSchema
Table: TestTable

ALTER TABLE TestTable ADD COLUMN Numbers VARCHAR(30);
INSERT INTO TestTable VALUES (1, 2);

At the minute it is to just have numbers in it. From what I have done for myself can anybody let me know if it will create a column called 'Numbers' and add a row with '1' and then a second with '2' as the data?

Cheers guys,

Davie



If I am understanding you correctly, you will need a separate insert statement for each record
Code:
INSERT INTO TestTable VALUES (1);
INSERT INTO TestTable VALUES (2);

Your syntax to add a column seems correct. Not a 100% thought since it is PostgreSQL
__________________
I would rather know than not know at all...



Reply With Quote
  #3  
Old January 5th, 2007, 01:54 PM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Mar 2005
Location: I used to live at home, now I stay at the house
Posts: 3,410 ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 1 Month 1 Week 3 Days 13 h 53 m 11 sec
Reputation Power: 344
Facebook
There is a specific PostgreSQL forum over at Dev Shed [ASP Free's
sister site] where you might be better off posting...
__________________
Support requests via PM will be ignored!
Route of Queue | The General FAQ Thread | HOW TO POST A QUESTION

Sign up with Matched.co.uk and earn up to £15 per website every month!


Reply With Quote
  #4  
Old January 5th, 2007, 05:35 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 57 m 26 sec
Reputation Power: 181
Why not just grab postgresql and install your own copy to fool around on? It's open source and free.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #5  
Old January 7th, 2007, 05:02 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,942 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 27 m 19 sec
Reputation Power: 2014
also, the field is not numeric so you have to
wrap the value with quotes:
Code:
INSERT INTO TestTable VALUES ('1');

the database, smart as it may be, won't change the
field type just because its name.

Reply With Quote
  #6  
Old January 8th, 2007, 03:43 AM
DavieCooper's Avatar
DavieCooper DavieCooper is offline
I Need More Tax Money, k?
ASP Free Novice (500 - 999 posts)
 
Join Date: Oct 2006
Location: Londonderry/Oxfordshire
Posts: 567 DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 32 m 35 sec
Reputation Power: 24
Cheers guys.

I do indeed have a copy of Postgres here, it's just I haven't really used it before so not sure what I am doing lol.

Reply With Quote
  #7  
Old January 8th, 2007, 04:55 AM
DavieCooper's Avatar
DavieCooper DavieCooper is offline
I Need More Tax Money, k?
ASP Free Novice (500 - 999 posts)
 
Join Date: Oct 2006
Location: Londonderry/Oxfordshire
Posts: 567 DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level)DavieCooper User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 32 m 35 sec
Reputation Power: 24
After some twiddling about I managed to get it to insert data into the rows

INSERT INTO "TestSchema"."TestTable" ("Numbers", "Description", "Data") VALUES ('AUP1', null, null);

Thanks again guys!

Reply With Quote
  #8  
Old January 8th, 2007, 05:01 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,942 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1Folding Points: 392772 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 27 m 19 sec
Reputation Power: 2014
cheers, glad you got it sorted!

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherASP Free Lounge > PostgreSQL Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT