Re: Query-Question with 4Y2M
Posted in 1998
andy@pneu.com wrote: > > Hello! i search for a way in sql to get an output jear and month like that: > yyyymm ...where mm must have an leading zero for months < 10. column-type is > date. my idea select YEAR(today) && MONTH(today) from anytable does not > work, the zero is missing..... in ace and 4gl, i would use "using....", but > in sql? Any Ideas (without changing any DBDATE-settings) ? Bye Andy M. > Bettin > > -----------== Posted via Deja News, The Discussion Network ==---------- > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own > If using the shell is an option, then a combination of the shell and sql will do the trick: the_month=`echo 'output to pipe "cat" without headings select month(today) from systables where tabid = 1 ' | isql tracsy - 2> /dev/null` if [ `expr $the_month : '.*'` -eq 1 ]; then the_month=0$the_month fi -- ______________________________________________________________________ | Colin McGrath cmm@trac3000.ueci.com | | Raytheon Engineers & Constructors, Inc. (215) 422-4144 | | Phila, PA, USA | | Any opinions I state are my own and not necessarily of my employer | |____________________________________________________________________|