Posts

Showing posts from 2020

Enable "clr enabled" configuration

  -- check if CLR is enabled SELECT * FROM sys . configurations WHERE name = 'clr enabled'   -- Value field i.e 0 - disable, 1- enable -- For enable clr sp_configure 'show advanced options' , 1 ; GO RECONFIGURE ; GO sp_configure 'clr enabled' , 1 ; GO RECONFIGURE ; GO

Divide by zero encountered in SSRS

Expression for Divide by zero encountered =iif(sum(Fields!Beta.Value)=0,0,sum(Fields!Alpha.Value)/sum(Fields!Beta.Value)) =iif(sum(Fields!Beta.Value)=0,0,sum(Fields!Alpha.Value)/iif(sum(Fields!Beta.Value)=0,1,sum(Fields!Beta.Value))

SSRS Date expressions

 First date of Current Month =Today.AddDays(1-Today.Day) last date of Current Month =Today.AddDays(1-Today.Day).AddMonths(1).AddDays(-1) First date of Current Year =Today.AddMonths(1-Today.month).AddDays(1-Today.day) Last date of Current Year =Today.AddDays(1-Today.Day).AddMonths(13-today.month).AddDays(-1) Previous Month Last Date =DateAdd("d",-(Day(today)), Today) Previous Month First Date =dateadd(dateinterval.month, -1, today().AddDays(-(today().Day-1))) Beginning of Current Month (EOM) =DateSerial(Year(Date.Now), Month(Date.Now), 1) Beginning of Last Month (BOM) =DateAdd(DateInterval.Month, -1, DateSerial(Year(Date.Now), Month(Date.Now), 1)) End of Last Month (EOM) =DateAdd(DateInterval.Minute, -1, DateSerial(Year(Date.Now), Month(Date.Now), 1)) Note : Gathered from google. Thanks to all bloggers

Cannot convert unicode to non-unicode ssis OLEDB destination in SSIS

Image
Solution : 1. add data conversion transformation in package as shown in bellow 2. Select field which you have problem and change data type to DT_STR and provide length as shown in bellow. 3. Repeat 2 nd step for bellow error 4. Repeat 2 nd step for bellow error 5. Execute package

An attempt was made to set credentials for a data source ' ' associated with the report. Report data source settings are specified in a way that prevents credentials from being submitted to the report server. (rsDataSourceNoPrompt)

Image
 Solution : Step 1: Go to data source under report data Step 2 : Double click on data source  Step 3 : Click on build tab and provide connection string information as highlight in bellow Step 4: Click on test connection , problem will resolve 

String Split

create function fnStringSplit (        @str   Varchar ( 100 ),        @delimiter   Varchar ( 1 ) ) returns @Temp   Table ( item varchar ( 100 )) AS begin --Declare @str as Varchar(100) = 'DXB-DEL/DEL-DXB/DEL-HYD/HYD-BLR' --Declare @delimiter As Varchar(1)='/' Declare @i as int = 0 Declare @j as int = 0 Set @j = ( Len ( @str ) - len ( REPLACE ( @str , @delimiter , '' ))) While @i   < = @j Begin   if @i   < @j   Begin       Insert into @Temp       Values ( SUBSTRING ( @str , 1 , Charindex ( @delimiter , @str , 1 )- 1 ))       set @str = right( @str ,( len ( @str )- Charindex ( @delimiter , @str , 1 )))   End   Else   Begin      Insert into @Temp Values ( @str )   End   Set @i = @i + 1 End --Select * from @Temp return end   select dbo . fnStringSplit ( 'DXB-DEL/DEL-DXB/DEL-HYD/HYD-BLR' , '/' )

SQL System Tables

Mapping System Tables to System Views   System table System views or functions sysaltfiles sys.master_files syscacheobjects sys.dm_exec_cached_plans sys.dm_exec_plan_attributes (Transact-SQL) sys.dm_exec_sql_text sys.dm_exec_cached_plan_dependent_objects syscharsets sys.syscharsets sysconfigures sys.configurations syscurconfigs sys.configurations sysdatabases sys.databases sysdevices sys.backup_devices syslanguages sys.syslanguages syslockinfo sys.dm_tran_locks syslocks sys.dm_tran_locks syslogins sys.server_principals sys.sql_logins sysmessages sys.messages sysoledbusers sys.linked_logins sysopentapes sys.dm_io_backup_tapes