[SQL] ORDER BY handling mixed integer and varchar values

2005-05-16 Thread David B
Hi All, I have a tabe Product_desc varchar(100) Product_price integer Product_catvarchar(100) The problem… We have categories such as: Electronics White Goods 1 2 5 15 25 etc I have a query Select product_desc, product_price, product_cat Order by product_cat, product_price And of cours

Re: [SQL] Unicode problem inserting records - Invalid UNICODE character

2004-11-11 Thread David B
: Wednesday, November 10, 2004 10:34 AM To: David B Cc: [EMAIL PROTECTED] Subject: Re: [SQL] Unicode problem inserting records - Invalid UNICODE character David B wrote: > My first time using unicode. Based on reading other messages I think I've > got it all setup correctly but stil

[SQL] Unicode problem inserting records - Invalid UNICODE character sequence found (0xfc7269)

2004-11-10 Thread David B
My first time using unicode. Based on reading other messages I think I've got it all setup correctly but still have prob. Running: psql 7.3.6-RH $ psql -l List of databases Name| Owner | Encoding ---+--+--- devdb | devuser | UNICODE template0 | pos

[SQL] In 7.4 ensure you have DEFAULT now () with no spaces

2004-06-18 Thread David B
Just a heads up folks... In converting from 7.3 to 7.4 one got-ya we had was... We had been testing 7.4 for a few days and just noticed that some tables had created_timestamp rows with a date/time of the date the DB was created...not the date/time the insert was done. Looking at those tables the

[SQL] Row counts/data changes. Any catalog table that has this info?

2004-06-05 Thread David B
Folks, Is there a catalog table or location where I can go to find data counts for tables? It would be nice if I could do a query which returned something like: table_name#Rows cust 1000 order 5000 order_detail 9500 without having to have the overhead of querying each tabl

[SQL] Syntax for cmd to EXEC...how many quotes?

2004-04-20 Thread David B
Folks, This is driving me crazy...I'm sure it's possible but that I am getting the #quotes wrong in some way... I keep getting unterminated string errors...now matter how many quotes I use. I have a FN that I want to loop through all views and populate a table with a count(*) from each views. To

[SQL] Elegant way to monitor for changes in a trigger and migrate record to history table

2004-02-10 Thread David B
Folks, Perhaps you can helphell I'm sure you can! I want to monitor for changes in a table and migrate the OLD. record to audit table. Is there an elegant or generic way to do this so I can use across multiple tables with little change. E.g. IF TG_OP = 'UPDATE' THEN INSERT INTO cust_hist

[SQL] Faster performance when using where cust_id = '123' vs cust_id = 123. Does 7.4 fix this??

2003-12-09 Thread David B
We have got used to the problem that queries of the format: select * from customer where cust_id = '123' are much much faster than select * from customer where cust_id = 123 (where cust_id is defined as bigint). a. Why is this. b. Will moving to v7.4 change this so we can avoid the whole '123'

[SQL] Referring to derived column name in a RECORD

2003-10-24 Thread David B
Hi folks, I know I'm doing something wrong here but cannot make it work no matter how many/few quotes I use I'm trying to reference a column in a RECORD which is not a column name but a derived column. Any suggestions??? Example code below to highlight the problem: DECLARE r_app RECO

[SQL] How to figure out when was a table created

2003-10-02 Thread David B
Hi folks, I posted this question a few days ago and got no response so I guess it cannot be done (surprising!) So that leaves me with my business problem. We create a table for each days activity. After N days (typically 7 days) we can drop the table. The table name is not known so cannot force b

[SQL] How to figure out when was a table created

2003-09-29 Thread David B
Folks, I have a list of tables for which I want to get the date they were created...and if possible the date last updateded. I suspect there is a pg_??? table that can answer this question but I don't know what it is and I cannot find it mentioned in any docs. Any suggestions...tia -D p.s. Love