Re: [SQL] Nocount and scope_identity()

2007-02-02 Thread Tom Lane
Andrew Sullivan <[EMAIL PROTECTED]> writes: > On Fri, Feb 02, 2007 at 01:38:40PM -0600, Demel, Jeff wrote: SCOPE_IDENTITY() method is going to work or not. >>> I doubt it. What does it do? >> >> It returns the id of the record just inserted. > Ah. Well, there's no in-principle notion if "

Re: [SQL] Nocount and scope_identity()

2007-02-02 Thread Andrew Sullivan
On Fri, Feb 02, 2007 at 01:38:40PM -0600, Demel, Jeff wrote: > Not as far as I know. What's it supposed to do? > > It suppresses the rowcount returned after the query runs. There isn't a way to do that, although there is a way in psql, for example, not to get all that formatting. You want the \

[SQL] Question regarding multibyte.

2007-02-02 Thread Karthikeyan Sundaram
Hi, I am new to postgres. We are using 8.2 release of postgres. Recently we converted our database to multibyte on our dev machine. we want to test the following. 1) How will I insert multibyte from our php? Do we need to use any special encoding? 2) I am using psql command line t

Re: [SQL] Nocount and scope_identity()

2007-02-02 Thread Demel, Jeff
> So, I'm wondering if NOCOUNT is supported in Postgres at all. If it's > not, what's the alternative? If it is, what is wrong with my syntax? Andrew wrote: Not as far as I know. What's it supposed to do? It suppresses the rowcount returned after the query runs. > I haven't gotten there yet,

Re: [SQL] Nocount and scope_identity()

2007-02-02 Thread Andrew Sullivan
On Fri, Feb 02, 2007 at 11:49:30AM -0600, Demel, Jeff wrote: > So, I'm wondering if NOCOUNT is supported in Postgres at all. If it's > not, what's the alternative? If it is, what is wrong with my syntax? Not as far as I know. What's it supposed to do? > I haven't gotten there yet, but I'm also

Re: [SQL] to_chat(bigint)

2007-02-02 Thread Bricklen Anderson
Ezequias Rodrigues da Rocha wrote: Hi list, Now I noticed that it is impossible to convert a bigint field to char with the function to_char. Is it correct ? If not please tell me how to convert a bigint using to_char. Couple ways I can see immedately: select 123123123123123123123::BIGINT::

[SQL] to_chat(bigint)

2007-02-02 Thread Ezequias Rodrigues da Rocha
Hi list, Now I noticed that it is impossible to convert a bigint field to char with the function to_char. Is it correct ? If not please tell me how to convert a bigint using to_char. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Atenciosam

[SQL] Nocount and scope_identity()

2007-02-02 Thread Demel, Jeff
I'm converting a MSSQL query to postgresql. It's something like this: SET NOCOUNT ON; INSERT INTO table_name([list]) VALUES([list]); SELECT SCOPE_IDENTITY() as newId; I get an error on the NOCOUNT statement: "syntax error at or near "on" at character 13" So, I'm wondering if NOCOUNT is supporte

Re: [SQL] Duplicate records

2007-02-02 Thread Andrew Sullivan
> > ps: I just think postresql could make this easyly. Don't you think ? Any > function or anything else. What's hard about the self-join? That's how SQL works. A -- Andrew Sullivan | [EMAIL PROTECTED] When my information changes, I alter my conclusions. What do you do sir?

Re: [SQL] Duplicate records

2007-02-02 Thread Ezequias Rodrigues da Rocha
You are correct. Sorry my mistake. The SQL statement is correct and I find the duplicate records. ps: I just think postresql could make this easyly. Don't you think ? Any function or anything else. Thank you so much. Ezequias 2007/2/2, Shoaib Mir <[EMAIL PROTECTED]>: Where do you see the sec

Re: [SQL] Duplicate records

2007-02-02 Thread Mezei Zoltán
Ezequias Rodrigues da Rocha wrote: Hi list, I am making some data minning and would like to know if someone tell me how to retrieve the duplicate records based in one or two fields of my table. Any help would be welcomed. You can use a simple query like this one: select t1.id, t2.id from t

Re: [SQL] Duplicate records

2007-02-02 Thread Bart Degryse
The only table in my query is "mytable". The part (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) counts how many records have the same field1 and field2 and returns a record per combination of field1 and field2 that have more than one (= duplicates) The

Re: [SQL] Duplicate records

2007-02-02 Thread Shoaib Mir
Where do you see the second table in it? I guess here: A = mytable B = (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) So that is all around one table that is 'mytable', where A and B are just the aliases. -- Shoaib Mir EnterpriseDB (www.enterprisedb.

Re: [SQL] Duplicate records

2007-02-02 Thread Ezequias Rodrigues da Rocha
Thank you but are you talking of two tables ? I intent to check in only one table. Please explain to me. Ezequias 2007/2/2, Bart Degryse <[EMAIL PROTECTED]>: select * from mytable A, (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) B where A.field1 =

Re: [SQL] Duplicate records

2007-02-02 Thread Bart Degryse
select * from mytable A, (select field1, field2, count(*) from mytable group by field1, field2 having count(*) > 1) B where A.field1 = B.field1 and A.field2 = B.field2 >>> "Ezequias Rodrigues da Rocha" <[EMAIL PROTECTED]> 2007-02-02 14:48 >>> Hi list, I am making some data minning and would like

Re: [SQL] Duplicate records

2007-02-02 Thread Shoaib Mir
That has been asked in the past a number of time too, you can look at the following for details --> http://archives.postgresql.org/pgsql-novice/2006-06/msg00093.php -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 2/2/07, Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: Hi list, I a

Re: [SQL] Insert into a date field

2007-02-02 Thread Ezequias Rodrigues da Rocha
Now it's ok thank you. 2007/2/2, Shoaib Mir <[EMAIL PROTECTED]>: Just tried the following way, that might help you: postgres=# create table testing (a date); CREATE TABLE postgres=# insert into testing values (to_date('1963-09-01', '-MM-DD')); INSERT 0 1 postgres=# select * from testing;

[SQL] Duplicate records

2007-02-02 Thread Ezequias Rodrigues da Rocha
Hi list, I am making some data minning and would like to know if someone tell me how to retrieve the duplicate records based in one or two fields of my table. Any help would be welcomed. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Atenci

Re: [SQL] Insert into a date field

2007-02-02 Thread Shoaib Mir
Just tried the following way, that might help you: postgres=# create table testing (a date); CREATE TABLE postgres=# insert into testing values (to_date('1963-09-01', '-MM-DD')); INSERT 0 1 postgres=# select * from testing; a 1963-09-01 (1 row) -- Shoaib Mir EnterpriseDB (ww

Re: [SQL] Insert into a date field

2007-02-02 Thread Richard Huxton
Ezequias Rodrigues da Rocha wrote: Hi list, I am trying to insert a record in a table with a date field but the postgresql reports me the following error: ERROR: column "data_nascimento" is of type date but expression is of type integer SQL state: 42804 Hint: You will need to rewrite or cast th

[SQL] Insert into a date field

2007-02-02 Thread Ezequias Rodrigues da Rocha
Hi list, I am trying to insert a record in a table with a date field but the postgresql reports me the following error: ERROR: column "data_nascimento" is of type date but expression is of type integer SQL state: 42804 Hint: You will need to rewrite or cast the expression. I tryed like this: