Re: [GENERAL] Date Comparison Help
Perfect and thank you so much for the swift response; At 04:23 PM 4/8/2004, Mike Nolan wrote: > I need a query to get data that is 6 months older than "today" or when that > query is run. WHERE table.date < current_date-interval'6 months' -- Mike Nolan Brian C. Doyle Director, Internet Services United Merchant Processing Association http://www.umpa-us.com 1-800-555-9665 ext 212
[GENERAL] Function Help
Hello all, I am working on a function to determine the date of the first saturday of the month. Currently I have: CREATE FUNCTION first_saturday(date) RETURNS date AS ' Select CASE WHEN date_part(\'dow\',\'$1\'::DATE)=0 THEN date(\'$1\')+6 WHEN date_part(\'dow\',\'$1\'::DATE)=1 THEN date(\'$1\')+5 WHEN date_part(\'dow\',\'$1\'::DATE)=2 THEN date(\'$1\')+4 WHEN date_part(\'dow\',\'$1\'::DATE)=3 THEN date(\'$1\')+3 WHEN date_part(\'dow\',\'$1\'::DATE)=4 THEN date(\'$1\')+2 WHEN date_part(\'dow\',\'$1\'::DATE)=5 THEN date(\'$1\')+1 WHEN date_part(\'dow\',\'$1\'::DATE)=6 THEN date(\'$1\')+0 END'LANGUAGE 'sql' I get an error that $1 is not a valid date. But I want that to be the variable I enter... what Am I doing wrong??? Brian C. Doyle Supervisor: Web Link Earthlink Web Hosting Technical Support [EMAIL PROTECTED] ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[GENERAL] Perl and Postgres
Hello all, Where can I look to find out more about developing a web based interface via Perl.. Currently I do it all via PHP but do to resources available for a project I have I need to convert over to perl.. I check the Postgres Doc's and there were no examples to help get me started. Any thing appreciated. ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [GENERAL] Function Help
The main reason is that I am not quering a table with it as of yet... Ultimately it will before query that is a Month do date query that does not use a calender month At 05:29 PM 9/24/01 -0700, Randal L. Schwartz wrote: > >>>>> "Brian" == Brian C Doyle <[EMAIL PROTECTED]> writes: > >Brian> Hello all, >Brian> I am working on a function to determine the date of the first saturday >Brian> of the month. > >Brian> Currently I have: > >Brian> CREATE FUNCTION first_saturday(date) >Brian> RETURNS date >Brian> AS ' >Brian> Select CASE WHEN date_part(\'dow\',\'$1\'::DATE)=0 THEN date(\'$1\')+6 >Brian> WHEN date_part(\'dow\',\'$1\'::DATE)=1 THEN date(\'$1\')+5 >Brian> WHEN date_part(\'dow\',\'$1\'::DATE)=2 THEN date(\'$1\')+4 >Brian> WHEN date_part(\'dow\',\'$1\'::DATE)=3 THEN date(\'$1\')+3 >Brian> WHEN date_part(\'dow\',\'$1\'::DATE)=4 THEN date(\'$1\')+2 >Brian> WHEN date_part(\'dow\',\'$1\'::DATE)=5 THEN date(\'$1\')+1 >Brian> WHEN date_part(\'dow\',\'$1\'::DATE)=6 THEN date(\'$1\')+0 >Brian> END'LANGUAGE 'sql' > >Brian> I get an error that $1 is not a valid date. But I want that to be the >Brian> variable I enter... >Brian> what Am I doing wrong??? > >Working too hard? :) > >why not just: > >My_Col + 6 - date_part('dow', My_Col) > >Don't even need a function for that. :) > >-- >Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 ><[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> >Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. >See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [GENERAL] Function Help
That was it... I knew it was something simple.. Thanks Peter!!! At 11:06 PM 9/24/01 +0200, Peter Eisentraut wrote: >Brian C. Doyle writes: > > > CREATE FUNCTION first_saturday(date) > > RETURNS date > > AS ' > > Select CASE WHEN date_part(\'dow\',\'$1\'::DATE)=0 THEN date(\'$1\')+6 > > WHEN date_part(\'dow\',\'$1\'::DATE)=1 THEN date(\'$1\')+5 > > WHEN date_part(\'dow\',\'$1\'::DATE)=2 THEN date(\'$1\')+4 > > WHEN date_part(\'dow\',\'$1\'::DATE)=3 THEN date(\'$1\')+3 > > WHEN date_part(\'dow\',\'$1\'::DATE)=4 THEN date(\'$1\')+2 > > WHEN date_part(\'dow\',\'$1\'::DATE)=5 THEN date(\'$1\')+1 > > WHEN date_part(\'dow\',\'$1\'::DATE)=6 THEN date(\'$1\')+0 > > END'LANGUAGE 'sql' > > > > I get an error that $1 is not a valid date. > >Don't quote the $1. E.g., > >WHEN date_part(\'dow\',$1)=6 THEN date($1)+0 > >The $1 etc. are not macros, they are identifiers representing a typed >expression. > >-- >Peter Eisentraut [EMAIL PROTECTED] http://funkturm.homeip.net/~peter > > >---(end of broadcast)--- >TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED] ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[GENERAL] Function Help
Hello all, I am working on a function to determine the date of the first saturday of the month. Currently I have: CREATE FUNCTION first_saturday(date) RETURNS date AS ' Select CASE WHEN date_part(\'dow\',\'$1\'::DATE)=0 THEN date(\'$1\')+6 WHEN date_part(\'dow\',\'$1\'::DATE)=1 THEN date(\'$1\')+5 WHEN date_part(\'dow\',\'$1\'::DATE)=2 THEN date(\'$1\')+4 WHEN date_part(\'dow\',\'$1\'::DATE)=3 THEN date(\'$1\')+3 WHEN date_part(\'dow\',\'$1\'::DATE)=4 THEN date(\'$1\')+2 WHEN date_part(\'dow\',\'$1\'::DATE)=5 THEN date(\'$1\')+1 WHEN date_part(\'dow\',\'$1\'::DATE)=6 THEN date(\'$1\')+0 END'LANGUAGE 'sql' I get an error that $1 is not a valid date. But I want that to be the variable I enter... what Am I doing wrong??? ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[GENERAL] Custom Insert function
Hello all, Is it possible to create a function that would look like this_function('file.csv'); and make it run COPY this_table FROM '/this/location/file.csv' USING DELIMITERS ','; Thus eliminating alot of repeated work each time??? if so what would I put on the returns ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[GENERAL] Postgres and C/C++
Hello all, Where would I find examples of some C files that connect to a postgresql db I am just starting out with c and know Postgresql rather well and have done a lot of development with PHP. So I need to know what else do I need to write a C program that will connect to a database in Postgresql and thus interact with that database. The interface I am trying to create is in windows with Postgresql in linux. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[GENERAL] Win Nt setup help please
Hello all, I am having problems with the setup of postgres on NT. I do have MSVisual C++ I have done: copy include\config.h.win32 include\config.h nmake /f win32.mak And I get NMake : fatal error u1077: 'cd' : return code '0x1' Stop Can any one help. I am using Version 1.62.7022 of NMake and postgresql 7.0.2 Thank you. ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[GENERAL] Sequence Help
Hello all, How would I setup a sequence that would reflect, for example, abc-0001?
[GENERAL] Table Creation on the Fly
Hello all, Is it at all possible to create a table on the fly from a CSV file?
Re: [GENERAL] Carrage Returns \ Line Breaks!
Okay now I am an Idoit. How do I tell what is used for the carriage return? I know how to make the replacement I just can not tell they characters used. At 11:52 AM 12/18/00 -0500, Brett W. McCoy wrote: >On Mon, 18 Dec 2000, Brian C. Doyle wrote: > > > I have a file that I am trying to import/copy into a table. The problem > > that I am having is that there are carriage returns through out the > > document. These carriage returns should be copied into the column it > > belongs to yet during the > > copy table from '/home/location/file.ext' using delimiters '|'; > > > > I get errors when it hits the carriage return. Can i get around this? > >You should convert the carriage returns into the literal text '\n'. Are >they ^J or ^M? > >-- Brett > http://www.chapelperilous.net/~bmccoy/ >--- >A soft answer turneth away wrath; but grievous words stir up anger. > -- Proverbs 15:1
[GENERAL] Carrage Returns \ Line Breaks!
Hello all, I have a file that I am trying to import/copy into a table. The problem that I am having is that there are carriage returns through out the document. These carriage returns should be copied into the column it belongs to yet during the copy table from '/home/location/file.ext' using delimiters '|'; I get errors when it hits the carriage return. Can i get around this?