2012-11-09

Ubuntu 12.04 - Installing and registering a DVD decryption library

I couldn't open any DVD... this fixed it. Run the following two commands on terminal. Don't worry if the first step tells you that you already have the library, as the second step registers it properly.


sudo apt-get install libdvdread4
sudo /usr/share/doc/libdvdread4/install-css.sh

Reference, source:
http://askubuntu.com/questions/109103/how-do-i-install-a-dvd-decryption-library


2012-09-21

TSQL - Excel numeric date to SQL date

select

       40756 as ExcelDate
       , cast(dateadd(d, 40756, '1899-12-30') as date ) as TSQLDate
;

Excel dates are represented by numbers.
Decimals represent time... which is out of the scope of this post.
The trick is knowing that day 1 is for January 1st, 1900 (1900-01-01).


2012-09-06

TSQL - Position of the first strange character


select PATINDEX('%[^A-Za-z0-9 ]%' , 'as-df.qwer' );

2012-08-17

TSQL - Scientific notation arithmetic warning


select 2E
union all select 3E
union all SELECT 2E-3E --> Doing 2E-3, ingnoring the extra "E".
union all select (2E)-(3E)
;
/*
2
3
0.002
-1
*/




2012-08-15

Teradata - How to rename a field or column


ALTER TABLE
DATABASE_NAME_HERE.TABLE_NAME_HERE
RENAME
CURRENT_FIELD_NAME_HERE
TO
NEW_FIELD_NAME_HERE
;

2012-08-08

TSQL - Dense rank vs rank vs row number


select
       T1.Field1
       , DENSE_RANK() over( order by Field1 asc ) as DenseRank
       , RANK() over( order by Field1 asc ) as DenseRank
       , ROW_NUMBER() over( order by Field1 asc ) as RowNumber
from
       (
              select 'a' as Field1
              union all select 'a'
              union all select 'a'
              union all select 'b'
              union all select 'b'
              union all select 'c'
              union all select 'd'
       ) as T1
;

2012-08-07

SSRS - Data alert grayed out, disabled

SSRS 2012
Sharepoint 2010 Foundation


"If the New Data Alert option is grayed, the report data source is configured to use integrated security credentials or prompt for credentials. To make the New Data Alert option available, you must update the data source to use stored credentials or no credentials."
- http://stackoverflow.com/questions/9680419/data-alerts-disabled-in-sharepoint-2010-installed-in-integrated-mode-with-ssrs