Friday, May 9, 2014

currency Conversion Languge settings for symbols in SSAS



Language ([Destination Currency].[Currency].&[2])=1027;  --- EUR
Language ([Destination Currency].[Currency].&[3])=1046;  --- Brazilian Real
Language ([Destination Currency].[Currency].&[4])=2057;   --- GBP
Language ([Destination Currency].[Currency].&[5])=3076;   ---HKD
Language ([Destination Currency].[Currency].&[6])=2052;  ---Chinese Yuan CNY
Language ([Destination Currency].[Currency].&[1])=1033;  --- USD

Friday, May 2, 2014

T-sql Query to update all NULL values with Empty String in all columns of a table

select 'update ' + table_name + ' set [' + column_name + '] = '  +
 CASE
    WHEN DATA_TYPE = 'bit' THEN '0'
    WHEN DATA_TYPE = 'int' THEN '0'
    WHEN DATA_TYPE = 'decimal' THEN '0'
    WHEN DATA_TYPE = 'date' THEN '''1/1/1900'''
    WHEN DATA_TYPE = 'datetime' THEN '''1/1/1900'''
    WHEN DATA_TYPE = 'uniqueidentifier' THEN '00000000-0000-0000-0000-000000000000'
    ELSE '''''' -- everything else get's an empty string
  END
+

' where [' + column_name + '] is null'
from information_schema.columns
where table_name = 'YourTable'
select 'update ' + table_name + ' set [' + column_name + '] = '''' where [' + column_name + '] is null'
from information_schema.columns
where table_name = 'yourtable'
SELECT 'ISNULL(' + COLUMN_NAME + ',' + 
  CASE 
    WHEN DATA_TYPE = 'bit' THEN '0'
    WHEN DATA_TYPE = 'int' THEN '0'
    WHEN DATA_TYPE = 'decimal' THEN '0'
    WHEN DATA_TYPE = 'date' THEN '''1/1/1900'''
    WHEN DATA_TYPE = 'datetime' THEN '''1/1/1900'''
    WHEN DATA_TYPE = 'uniqueidentifier' THEN '00000000-0000-0000-0000-000000000000'
    ELSE '''''' -- everything else get's an empty string
  END + ') AS ' + COLUMN_NAME + ','
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TableName'