Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Update entire column with new date values



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 



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group