martedì 3 maggio 2011

MSAccess test/check vowels for last letter of a field.

Here is the example :


SELECT ClientiFunzioniCustom.[Funzione] FROM FunzioniCustom where
MID(TRIM(FunzioniCustom.[Funzione]),LEN(TRIM(FunzioniCustom.[Funzione])),LEN(TRIM(FunzioniCustom.[Funzione]))+1) Not  in('A','E','I','O','U');

MSAccess SQL Capitalize

To capialize a string of a field you should use API STRCONV
like following example :
SELECT DISTINCT(STRCONV(FunzioniCustom.[Funzione],3)) FROM FunzioniCustom;

giovedì 17 febbraio 2011

DECODE & dual for DB2

DECODE from oracle
-- SELECT CASE MESE WHEN '02' THEN 'Febbraio' WHEN '03' THEN 'Marzo'
WHEN '04' THEN 'Aprile' ELSE 'Boh' END from MESI


Dual from Oracle is SYSIBM.SYSDUMMY1 for DB2
-- SELECT 'CIAO' FROm SYSIBM.SYSDUMMY1

martedì 15 febbraio 2011

Create FDF with password using iText

Create FDF with password using java and itext.
In this site good tutorial.

in riferimento a: iText in Action: example part3.chapter09.CreateFDF (visualizza su Google Sidewiki)

lunedì 31 gennaio 2011

Oracle objects determine creation date

<code type="sql">
select OWNER, OBJECT_NAME, to_char(CREATED,'MM/DD/YYYY HH24:MI:SS')
created, status from dba_objects
where OWNER in ('MYSCHEMA') and OBJECT_TYPE='VIEW'
order by OWNER,OBJECT_NAME
</code>

giovedì 20 gennaio 2011

Java StackStrace to String

<code type="java">
catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
System.out.println(sw.toString().toUpperCase());
}
</code>

martedì 11 gennaio 2011

Return Userdn form a LDAP search

<code type="java">
SearchResult searchResult = null;
if (namEnum.hasMore()) {
searchResult = (SearchResult) namEnum.next();

// Build the User DN
userDN = searchResult.getName() + "," + sAPPEND_BASE_DN;
} else {
// User not found
throw new NamingException(" Invalid Username ");
}
System.out.println("User DN="+userDN);
</code>