Note: "DELEMITER" should be "DELIMITER".
On Thu, Apr 18, 2013 at 1:34 AM, basti wrote:
> I have fixed it with dollar-quoting.
>
> Original-Nachricht ---- Betreff: [SQL] copy from csv,
> variable filename within a function Datum: Thu, 18 Apr 2
I have fixed it with dollar-quoting.
Original-Nachricht
Betreff:[SQL] copy from csv, variable filename within a function
Datum: Thu, 18 Apr 2013 09:26:09 +0200
Von:basti
An: pgsql-sql@postgresql.org
Hello,
i have try the following:
-- Function
Hello,
i have try the following:
-- Function: wetter.copy_ignore_duplicate(character varying)
-- DROP FUNCTION wetter.copy_ignore_duplicate(character varying);
CREATE OR REPLACE FUNCTION wetter.copy_ignore_duplicate(_filename
character varying)
RETURNS void AS
$BODY$
declare sql text;
BEGI
Hi,
For what it's worth, WindowsXP (at least) seems to currently support
forward slashes at the OS level, so this Postgres behavior isn't as odd
as it might seem. If you enclose your paths with double quote (")
marks, Windows will even accept Unix style paths for some instructions
on the comm
Paul Lambert wrote:
Phillip Smith wrote:
"Having said that, if I switch it to a forward slash it works without
error... odd, given that weenblows standard is backslash."
Yes, but PostgreSQL uses a back-slash as an escape character, which
needs to
be used to escape itself at an application lev
Phillip Smith wrote:
"Having said that, if I switch it to a forward slash it works without
error... odd, given that weenblows standard is backslash."
Yes, but PostgreSQL uses a back-slash as an escape character, which needs to
be used to escape itself at an application level before the O/S gets
al
with it :)
-p
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Paul Lambert
Sent: Monday, 12 February 2007 11:09
To: Joe
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] COPY FROM query.
Joe wrote:
> Hi Paul,
>
> On Mon, 2007-02-12 at 08:19 +0900,
Joe wrote:
Hi Paul,
On Mon, 2007-02-12 at 08:19 +0900, Paul Lambert wrote:
I'm attempting to copy from a table into a file using a select query
inside the copy.
The following is my command:
COPY (SELECT DISTINCT ON (dealer_id,appraisal_id) * FROM
appraisals_temp) TO 'c:\autodrs_appraisal_ne
Hi Paul,
On Mon, 2007-02-12 at 08:19 +0900, Paul Lambert wrote:
> I'm attempting to copy from a table into a file using a select query
> inside the copy.
>
> The following is my command:
>
> COPY (SELECT DISTINCT ON (dealer_id,appraisal_id) * FROM
> appraisals_temp) TO 'c:\autodrs_appraisal_ne
An INSERT INTO will fix my problem with needing the extra copy from and
copy to.
I'm still curious as to why i was being told I couldn't specify a
relative path though.
P.
--
Paul Lambert
Database Administrator
AutoLedgers
---(end of broadcast)--
I'm attempting to copy from a table into a file using a select query
inside the copy.
The following is my command:
COPY (SELECT DISTINCT ON (dealer_id,appraisal_id) * FROM
appraisals_temp) TO 'c:\autodrs_appraisal_new.txt' WITH DELIMITER AS '^'
CSV HEADER;
I get the following returned:
WAR
That works like a charm. Thanks, Alvaro!
-Jeff
-Original Message-
From: Alvaro Herrera [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 08, 2007 1:22 PM
To: Demel, Jeff
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] COPY FROM - force a value
Demel, Jeff wrote:
> Is there a way
Demel, Jeff wrote:
> Is there a way to force a value when you're doing a COPY FROM, importing
> a file into a table?
>
> Here's my query as it is now:
>
> COPY filetable (value1, value2, value3, value4, forcevalue1,
> forcevalue2)
> FROM 'C:\\InsertFiles\\thisfile.txt'
> WITH DELIMITER AS ' '
Is there a way to force a value when you're doing a COPY FROM, importing
a file into a table?
Here's my query as it is now:
COPY filetable (value1, value2, value3, value4, forcevalue1,
forcevalue2)
FROM 'C:\\InsertFiles\\thisfile.txt'
WITH DELIMITER AS ' '
;
The file only contains data for
On 11/21/06, Steve Midgley <[EMAIL PROTECTED]> wrote:
Hello,
(I already fear the answer to my question is "no..") :)
I am using the 'COPY FROM' SQL command (not psql \copy) to move data
into a table from a CSV file. The source data are suitable for import
EXCEPT there are extraneous columns of
On 10/20/2004 6:03 PM, Gifford Hesketh wrote:
Am I forgetting some limitation ? I get "ERROR: syntax error at or
near "$1" at character 22" with this:
CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS
'
COPY b_import FROM $1 ;
'
LANGUAGE 'sql' STABLE;
Utility statements don't accept par
Am I forgetting some limitation ? I get "ERROR: syntax error at or
near "$1" at character 22" with this:
CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS
'
COPY b_import FROM $1 ;
'
LANGUAGE 'sql' STABLE;
---(end of broadcast)---
TIP 4:
copy that table out .
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Christoph Haller
Sent: 27 February 2003 12:45
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [SQL] Copy from a SELECT
>
> I know that the COPY command requires that you work with pl
I know that the COPY command requires that you work with plain
tables.
Is there any other way at all of export only part of a table
---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
Kenneth Evans writes:
> On the other hand the COPY FROM file command has it the other way round - if the
>separators are semi-colons then the source file
> London;12;15.7
> Paris;13;22.2
> will work
>
> but
> 'London'; '12'; '15.7'
> 'Paris';'13';'22.2'
> will not!
The COPY input data is a separ
a) First an observation about populating
tables.
The standard syntax for literal values is to put
single quotes around all the strings and not around the numbers eg
insert into table values ('London', 12,
15.7);
However when bulk loading from files it needs an
extra step to find out which f
Terry Fielder writes:
> Is there somewhere that I can either enable the first line of CSV as
> header names
>
> OR
>
> Can I explicitly define my import field ordering from within the select
> statement?
No and no. You will have to preprocess your file. Something like this
will probably do:
#
I guess this is really a SQL question:
I have a csv that I want to import, but the csv has different column
ordering.
I have tried putting the column names in the first row, but then the
copy command fails on field which is data type (eg it is seeing the
cells in first row as data, not header in
On Tue, 15 Aug 2000, Adam Lang wrote:
> Gotcha. Now, if I do an insert and just don't specify that field at all, it
> will, use the default value, correct? As long as I don't "touch" the field
> with anything it uses the default.
Right, as long as you don't specify the field in the column lis
Sort of. You can give the field a default value of
nextval() which means that if you do not specify
the column in an insert, it automatically gets the default
value which should be the next value in the sequence.
Note, that not putting the column is different from inserting a
NULL into the field
Well, if you define your main table to have a serial, or an explicit
default nextval(seqid), you won't even need to do that. Just leave
the column off the insert list and the default should fill it for you.
Stephan Szabo
[EMAIL PROTECTED]
On Tue, 15 Aug 2000, Adam Lang wrote:
> I get it. I up
-
From: "Stephan Szabo" <[EMAIL PROTECTED]>
To: "Adam Lang" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, August 15, 2000 2:00 PM
Subject: Re: [SQL] copy from
>
> Sort of. You can give the field a default value of
> nextval() w
sage -
From: "Stephan Szabo" <[EMAIL PROTECTED]>
To: "Adam Lang" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, August 15, 2000 12:34 PM
Subject: Re: [SQL] copy from
> Well, if you define your main table to have a serial, or an explicit
ot;Adam Lang" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, August 14, 2000 5:17 PM
Subject: Re: [SQL] copy from
>
> One way would be to copy the data into a temporary table that doesn't
> have the id field, and then
> insert into table (fields) select * from
I need additional help involving the copy from command
I have a database with several fields: id, name, address, zip
id is the primary key and I use nextval to get a value.
The file I want to upload is in comma separated value, that does not have a
primry key (or an id) field.
How would I use
30 matches
Mail list logo