Update entire column with new date values

From: "Weiss, Kevin" <kevin(dot)weiss(at)selkirkinc(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Update entire column with new date values
Date: 2006-07-27 15:17:48
Message-ID: BD328298CB3CDA44841417E3BA302335044DC7BE@exchange1.selkirkinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I have a simple table which contains information about our safety files:

CREATE TABLE docs
(
filename varchar(256) NOT NULL,
filepath varchar(256) NOT NULL,
version varchar(8),
date timestamp NOT NULL,
docid int8 NOT NULL DEFAULT nextval('docs_docid_seq'::regclass),
category varchar(16), NOT NULL
CONSTRAINT pkey_docs PRIMARY KEY (docid, filename, date),
CONSTRAINT ukey_docid UNIQUE (docid)
)

I need to update the date for each file (the "date" & "filename"
columns). However, the updated values for date are not the same for each
file (due to when the files were last modified). I can import the new
date values from a text file containing the date and filename.

What sort of "UPDATE" command do I use in this case? Essentially, I'm
trying to do something like:

UPDATE docs SET date = '{$input_date}'
FROM ('C:/Temp/docupdate.txt')
WHERE filename = '{$input_filename}';

Any help is appreciated. Thanks!

Kevin Weiss
kevin(dot)weiss(at)selkirkinc(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jasbinder Bali 2006-07-27 15:32:15 Permissions to connect to postgres database
Previous Message Laboratorio Tux 2006-07-27 15:02:18 Consulta de importar o restaurar base