# tips.sql -- tips for sql # $Id$ # Carlos Duarte , 991031 -- sleeps 23:59:59 secs waitfor delay "23:59:59" sybase dbms_lock.sleep(10); oracle (sleep 10 seconds) -- drop proc only if exists if object_id("p_my_proc") <> NULL drop procedure p_my_proc -- printing with arguments print "%1!: dropping table '%2!'", @my_proc, @my_table -- only return first N rows sybase: set rowcount N select * from my_table oracle: select * from my_table where rownum <= N -- turn off rowcount set rowcount 0 select * from my_table -- NULLs on SYBASE, NULL+x has different behaviors, depending on X, so: NULL+string_var = string_var NULL+string_lit = error NULL+num_var = NULL NULL+num_lit = NULL that is: numerically, NULL is absorber, while on other data types, is absorbed. -- datediff oracle: select date2 - date1 from dual -- difference of dates in days (float value)