Re: [SQL] sql: "LIKE" problem

2005-03-13 Thread Tom Lane
"Her Goo" <[EMAIL PROTECTED]> writes: > I want to go a step further, and restrict the results to those > that begin with string "abc\d". You need four backslashes for that, because \ is special to both the string literal parser and the LIKE operator. So '' reduces to a string constant conta

[SQL] lower and unicode

2005-03-13 Thread pginfo
Hi , I tested the lower with unicode on 8.0.1 and find it not to work. If I have only latin symbols it is working well, but if I try to use also cyrillic the lower simpli ignore this symbols and all stay as is. I readet that this will work on 8.x . Exists some one using lower/upper + unicode and w

[SQL] sql: "LIKE" problem

2005-03-13 Thread Her Goo
I am using "postgresql-7.3.2-1" now! I met a problem when using "LIKE" in "WHERE" clause. For example, a table named "t_test", and its data looks like below: # SELECT * FROM t_test; id | c_name + 1 | abc\ 2 | abc\de (2 rows) The thing I want to do is searching in above table an

[SQL] outputting dates

2005-03-13 Thread Kenneth Gonsalves
hi, i have set my datetype to 'European, SQL'. This correctly accepts dates of the form dd/mm/. However, the output is still in the '-mm-dd' format. How do i get the default output as dd/mm/? -- regards kg http://www.livejournal.com/users/lawgon tally ho! http://avsap.sourceforge.ne

Re: [SQL] Newbie wonder...

2005-03-13 Thread Sean Davis
Bernard, If you are simply doing a one-time convert of an old database schema to a new one, simply load the old tables into postgres and then use SQL commands to insert the data into the new tables. For a sequence on the "existing table," you can do as above and load the old table or just use c

Re: [SQL] plpgsql & date-time functions

2005-03-13 Thread Stephan Szabo
On Tue, 8 Mar 2005, Fatih Cerit wrote: > I have a function and I want to update a table's two rows but having problem > with plpgsql & date-time functions. First field of the table must be now() > this is ok.. but the second field must be now() + '60 days' if the query > like this : SELECT INTO to

Re: [SQL] [ADMIN] Postgres schema comparison.

2005-03-13 Thread Matteo Beccati
Hi, I have the wonderful job of re-synch'ing all the schemas out there not conforming to the master. I've looked everywhere for something that will help doing this. I'm specifically looking for a way to do a sumcheck or something similar on tables and/or schema as a whole to be able to do a table

Re: [SQL] Update PostgreSQL from MS SQL trigger

2005-03-13 Thread Igor Kryltsov
I managed to link PostgreSQL to MSSQL as a linked server but: select * from [TEST].[test].[public].[users] << wrote in message news:[EMAIL PROTECTED] > Hi, > > I have table 'test_m'(id integer) in MSSQL and I want to write > on_test_m_insert trigger in MS SQL which will insert value into PostgreSQ

[SQL] group by before and after date

2005-03-13 Thread Sim Zacks
I have 2 tables 1 has a date field and component need by that date and the other has all the upcoming orders. I am trying to build a query that will give me the Date and ComponentNeed and also how many components have been ordered before that date and how many after. PostGreSQL is telling me I need

Re: [SQL] group by before and after date

2005-03-13 Thread Sim Zacks
I got it. I had to put the whole case statement into the sum so my statement ended up: select a.DueDate,a.PartID,a.AmountNeeded,a.CurrentStock, sum(coalesce(case when b.DatePromisedBy<=a.DueDate then coalesce(b.QuantityOrdered,0)-coalesce(b.DeliveredSum,0) end,0)) as ExpectedBefore, sum(coale

[SQL] plpgsql & date-time functions

2005-03-13 Thread Fatih Cerit
I have a function and I want to update a table's two rows but having problem with plpgsql & date-time functions. First field of the table must be now() this is ok.. but the second field must be now() + '60 days' if the query like this : SELECT INTO to_day now() + interval '60 days' ; it works bu

[SQL] Newbie wonder...

2005-03-13 Thread Bernard Grosperrin
Please, bear with me, as this is my first post here. (1) I have a 2 table database, result of a conversion from Access. This has been made by an amateur, as one of the tables should be at least 3 related tables, bunch of redundant data,and the other one 2. I know I could create a table as the res

[SQL] Update PostgreSQL from MS SQL trigger

2005-03-13 Thread Igor Kryltsov
Hi, I have table 'test_m'(id integer) in MSSQL and I want to write on_test_m_insert trigger in MS SQL which will insert value into PostgreSQL table 'test_p' from database 'test_db' running on host '10.3.2.5'. Can this be achieved with PostgreSQL ODBC driver? If yes, please post template of such t

[SQL] How to cast VARCHAR to BYTEA and vice-versa?

2005-03-13 Thread Moran.Michael
Hello all, I have a table with a VARCHAR column that I need to convert to a BYTEA. How do I cast VARCHAR to BYTEA? The following doesn't seem to work as it yields the 'cannot cast varchar to bytea' error message: varchar_data::bytea On the same topic, how do I do the reverse, that is,

[SQL] finding schema of table that called a trigger

2005-03-13 Thread Jeff Hoffmann
Is there a variable defined that has the schema of the table that called the trigger (like TG_RELNAME = table name)? I didn't see anything in the documentation. Is the only way to get that to look it up with TG_RELID? -- Jeff Hoffmann [EMAIL PROTECTED] ---(end of broadc