vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| In our database is a decimal field with format YYMMDDhhmmss.9999999999 where the 9s are random digits. I'm trying to strip off just the YYMMDD and put it in date form. So far I came up with: SUBSTR(TO_CHAR(rec_num,99999999999),1,6) AS Date which returns YMMDD. For example where the rec_num is 30608124143.47069519725 the above functions return 30608. I tried wrapping another TO_CHAR around it to try to format it to a date but this seems like it's a bit much for this purpose. Any suggestions would be appreciated. -David |
| |||
| "wireless" <wireless200@yahoo.com> wrote in message news:90446ee7.0309161123.ae79c7e@posting.google.co m... > In our database is a decimal field with format YYMMDDhhmmss.9999999999 > where the 9s are random digits. I'm trying to strip off just the > YYMMDD and put it in date form. > > So far I came up with: > SUBSTR(TO_CHAR(rec_num,99999999999),1,6) AS Date which returns YMMDD. > > For example where the rec_num is 30608124143.47069519725 the above > functions return 30608. > > I tried wrapping another TO_CHAR around it to try to format it to a > date but this seems like it's a bit much for this purpose. > > Any suggestions would be appreciated. > > -David I think you may have posted this to the wrong group - SUBSTR() and TO_CHAR() are not MS SQL Server functions. Simon |
| ||||
| "Simon Hayes" <sql@hayes.ch> wrote: > I think you may have posted this to the wrong group - SUBSTR() and TO_CHAR() > are not MS SQL Server functions. Yes, right. We've got three different database types here (MS, Oracle,and Postgre) and sometimes the tsql runs together with the psql. -David (I wish they were all sql servers) |