Update entire column with new date values

Поиск
Список
Период
Сортировка
От Weiss, Kevin
Тема Update entire column with new date values
Дата
Msg-id BD328298CB3CDA44841417E3BA302335044DC7BE@exchange1.selkirkinc.com
обсуждение исходный текст
Ответы Re: Update entire column with new date values
Re: Update entire column with new date values
Список 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.weiss@selkirkinc.com

В списке pgsql-general по дате отправления:

Предыдущее
От: "Jasbinder Bali"
Дата:
Сообщение: Permissions to connect to postgres database
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Generating unique session ids