Is it possible to alter field type (from varchar to text) without making
a new table?
Regards,
BTJ
--
-----------------------------------------------------------------------------------------------
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange
Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
-----------------------------------------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match 11 1974
Hi,
Am Do, den 26.08.2004 schrieb Bjørn T Johansen um 9:48: Is it possible to alter field type (from varchar to text) without making a new table?
In 8.0 I think.
Common practice in 7.4.x is:
BEGIN work;
ALTER TABLE yourtable ADD COLUMN tempcolumn text;
UPDATE yourtable SET tempcolumn = origcolumn;
ALTER TABLE yourtable DROP COLUMN origcolumn;
ALTER TABLE yourtable RENAME tempcolumn TO origcolumn;
COMMIT work;
Since text and (unlimited) varchar are quite the same,
you could get away with modifying the system tables.
But I would not recomment to do so.
Regards
Tino Wildenhain
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly
Bjørn T Johansen <bt*@havleik.no > writes: Is it possible to alter field type (from varchar to text) without making a new table?
You can add a new column, update the table to set the new column to the old
value. then drop the old column. Then you might want to vacuum full the table.
In 8.0 there will be a command to do what you want, but it will still have to
do all the same work as I described above.
--
greg
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)
That looks like a recipe, thx... :)
BTJ
Tino Wildenhain wrote: Hi,
Am Do, den 26.08.2004 schrieb Bjørn T Johansen um 9:48:
Is it possible to alter field type (from varchar to text) without making a new table?
In 8.0 I think. Common practice in 7.4.x is:
BEGIN work; ALTER TABLE yourtable ADD COLUMN tempcolumn text; UPDATE yourtable SET tempcolumn = origcolumn; ALTER TABLE yourtable DROP COLUMN origcolumn; ALTER TABLE yourtable RENAME tempcolumn TO origcolumn; COMMIT work;
Since text and (unlimited) varchar are quite the same, you could get away with modifying the system tables. But I would not recomment to do so.
Regards Tino Wildenhain
--
-----------------------------------------------------------------------------------------------
Bjørn T Johansen (BSc,MNIF)
Executive Manager bt*@havleik.no Havleik Consulting
Phone : +47 21 69 15 20 Bjørnebærstien 57
Fax : +47 41 13 09 15 N-1348 Rykkinn
Cellular : +47 926 93 298 http://www.havleik.no
-----------------------------------------------------------------------------------------------
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange
Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
-----------------------------------------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org
On 26 Aug 2004 04:36:18 -0400, Greg Stark <gs*****@mit.ed u> wrote: Bjørn T Johansen <bt*@havleik.no > writes: Is it possible to alter field type (from varchar to text) without making a new table? You can add a new column, update the table to set the new column to the old value. then drop the old column. Then you might want to vacuum full the table.
Does vacuum full completely remove the dropped column?
Thanks
--
Markus Bertheau <mb*******@gmai l.com>
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives? http://archives.postgresql.org
This may sound like a silly question....
I am currently running 7.4.2.
I would like to upgrade to 7.4.5...
So I downloaded postgresql-7.4.5.tar.gz
<ftp://ftp21.us.postgr esql.org/pub/postgresql/v7.4.5/postgresql-7.4.5.tar.gz>
uncompressed...
configure...
make
make install
I run psql and it gives me the" Welcome to psql 7.4.5, the PostgreSQL
interactive terminal."
So far so good...it says 7.4.5.
but when I select version() from the database that I connected to with
psql, I still receive:
PostgreSQL 7.4.2 on i386-portbld-freebsd5.2.1, compiled by GCC cc (GCC)
3.3.3 [FreeBSD] 20031106
Is the database itself versioned?
Do I need to do a dump/restore?
Jeff
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
On 8/27/2004 12:21 PM, Jeff Amiel wrote: This may sound like a silly question.... I am currently running 7.4.2. I would like to upgrade to 7.4.5...
So I downloaded postgresql-7.4.5.tar.gz <ftp://ftp21.us.postgr esql.org/pub/postgresql/v7.4.5/postgresql-7.4.5.tar.gz> uncompressed... configure...
try
eval ./configure `/usr/bin/pg_config --configure`
Jan
make make install
I run psql and it gives me the" Welcome to psql 7.4.5, the PostgreSQL interactive terminal." So far so good...it says 7.4.5.
but when I select version() from the database that I connected to with psql, I still receive: PostgreSQL 7.4.2 on i386-portbld-freebsd5.2.1, compiled by GCC cc (GCC) 3.3.3 [FreeBSD] 20031106
Is the database itself versioned?
Do I need to do a dump/restore?
Jeff
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
--
#============== =============== =============== =============== ===========#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#============== =============== =============== ====== Ja******@Yahoo. com #
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)
Ok......still no dice.
still shows 7.4.2 when I select version()...
I must surely be doing something silly here...
Jan Wieck wrote: On 8/27/2004 12:21 PM, Jeff Amiel wrote:
This may sound like a silly question.... I am currently running 7.4.2. I would like to upgrade to 7.4.5...
So I downloaded postgresql-7.4.5.tar.gz <ftp://ftp21.us.postgr esql.org/pub/postgresql/v7.4.5/postgresql-7.4.5.tar.gz>
uncompressed... configure...
try
eval ./configure `/usr/bin/pg_config --configure`
Jan
make make install
I run psql and it gives me the" Welcome to psql 7.4.5, the PostgreSQL interactive terminal." So far so good...it says 7.4.5.
but when I select version() from the database that I connected to with psql, I still receive: PostgreSQL 7.4.2 on i386-portbld-freebsd5.2.1, compiled by GCC cc (GCC) 3.3.3 [FreeBSD] 20031106
Is the database itself versioned?
Do I need to do a dump/restore?
Jeff
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)
Jeff Amiel <ja****@istream imaging.com> writes: So I downloaded postgresql-7.4.5.tar.gz <ftp://ftp21.us.postgr esql.org/pub/postgresql/v7.4.5/postgresql-7.4.5.tar.gz> uncompressed... configure... make make install
I run psql and it gives me the" Welcome to psql 7.4.5, the PostgreSQL interactive terminal." So far so good...it says 7.4.5.
but when I select version() from the database that I connected to with psql, I still receive: PostgreSQL 7.4.2 on i386-portbld-freebsd5.2.1, compiled by GCC cc (GCC) 3.3.3 [FreeBSD] 20031106
Did you shut down and restart the server after the upgrade? Are you
sure the new binaries went where you think they did?
-Doug
--
Let us cross over the river, and rest under the shade of the trees.
--T. J. Jackson, 1863
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)
Duh. I never restarted the server.
sheesh.
thanks to all.
Jeff
Doug McNaught wrote: Did you shut down and restart the server after the upgrade? Are you sure the new binaries went where you think they did?
-Doug
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Geoff Jones |
last post by:
Hi
I have a table that contains date/time together in one field. Is it possible
to ALTER the table so that this field now only contains the time (or date)?
Thanks in advance
Geoff
P.S. If possible I'd like to do this during the SELECT stage.
|
by: leegold2 |
last post by:
mysql> describe keywords;
+-------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+----------------+
| page_id | int(10) unsigned | | PRI | NULL | auto_increment |
| keyword_txt | text | YES | | NULL | |...
|
by: Euler Almeida via SQLMonster.com |
last post by:
Hi people,
I?m trying to alter a integer field to a decimal(12,4) field in MSACCESS 2K.
Example:
table : item_nota_fiscal_forn_setor_publico
field : qtd_mercadoria integer NOT NULL
ALTER TABLE item_nota_fiscal_forn_setor_publico
ALTER COLUMN qtd_mercadoria decimal(12,4) NOT NULL
|
by: Alan Mailer |
last post by:
I'm sorry if this one has been asked and answered a million times:
Is it possible to have a VB6 app alter the name of an *existing* field
in Access 2002 database? To be clear, I'm not talking about adding a
new field to the Access database. I want to change the name of an
*existing* field using a VB6 app.
What type of VB6 code would you use to do this? And please, if your
suggestion involves using Project References other than...
|
by: vasilip |
last post by:
I'm testing out db2 for a project I'm starting that requires proper xml
support and I can't seem to get both xml and spatial data to work well
in the same table.
Once having created a table containing both xml and spatial data fields
I can't seem to find a way to alter the table
I have created a table containing an id, xmldata field and a ST_Point
If I try to drop the xml field with ALTER TABLE TEST DROP COLUMN
| |
by: sparks |
last post by:
several months ago I was trying to set the field size of text fields
in a table and Lyle Fairfield was nice enought to post a way using
alter column.
it was surprising since it was ALTER COLUMN f5 Text(250)
WHERE in the world can I find the a listing of the different things
that can be done with this?
|
by: terenceyuen |
last post by:
I would like to change the type of Null to NO ,what is the command for this?
I've tried this one, but no luck to get it work.
ALTER TABLE claims_summary ALTER COLUMN advance_call_details SET NOT NULL;
Thanks.
Terence
+----------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+--------------+------+-----+---------+-------+
| client_id | int(11) | |...
|
by: rcamarda |
last post by:
Hello,
I need to alter fields in all my tables of a given database, and I
would to do this via a t-sql script.
Example, I want to change all fields called SESSION_ID to char(6). The
field is usually varchar(10), but the data is always 6 characters in
length. I have serveral fields that are fixed length that I want to
move from varchar to char.
I believe I can find all the tables where the field exists using
select * from...
|
by: goyosito |
last post by:
I'm working with DB2 ver. 8.x and I'm trying to change the precision of decimal(10) to decimal(20). My script is:
ALTER TABLE xyz
ALTER COLUMN campo SET DATA TYPE DECIMAL(20, 0);
but I got this error:
DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: ALTER TABLE xyz
ALTER COLUM;BEGIN-OF-STATEMENT;<values>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |