Tuesday, June 26, 2018

SSIS: Cannot convert between unicode and non-unicode string data types

Best thing to resolve this to add Data Conversion transformations to convert string columns from non-Unicode (DT_STR) to Unicode (DT_WSTR) strings.

You need to do this for all the string columns.

dc-1

Add a data conversion task between OLEDB and EXCEL Destinations and do string conversations like below for the columns you are using

dc-2

Monday, June 25, 2018

.NET Core 2.0 will reach End of Life on October 1, 2018

.NET Core 2.0 was released on August 14, 2017. As a non-LTS release, it is supported for 3 months after the next release. .NET Core 2.1 was released on May 30th, 2018.

Upgrade to .NET Core 2.1

The supported upgrade path from .NET Core 2.0 is via .NET Core 2.1. Instructions for upgrading can be found in the following documents:

.NET Core 2.1 will be a long-term support release. Its recommend that you make .NET Core 2.1 your new standard for .NET Core development.

Wednesday, June 13, 2018

'TRUNCATE_ONLY' is not a recognized BACKUP option.

In Microsoft SQL server 2000 and 2005, as part of the ‘BACKUP LOG’ command, there was an option to truncate the log file, without storing a backup to file. In Microsoft SQL Server 2008, this option has been removed, and you can now no longer use the ‘TRUNCATE_ONLY’ option when performing a transaction log backup.

The truncate only option is used to truncate the log file. This is generally done so you can then shrink the transaction log file, and recover the disk space back to the file system.

I ran into this issue, when we are migrating our servers from 2005 to higher version.

Msg 155, Level 15, State 1, Line 1
'TRUNCATE_ONLY' is not a recognized BACKUP option.

To truncate the transaction log file in Microsoft SQL Server 2008 or 2012 and above, without making an actual transaction log backup (possibly due to free space limitations), you need to change the recovery model of the database to “Simple”, and then change it back to “Full” (or “Bulked Logged” if that’s what it was previously).

USE ps;
GO

-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE ps
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (ps_log, 1);  
-- here 2 is the file ID for trasaction log file
--you can also mention the log file name (dbname_log)
GO

-- Reset the database recovery model.
ALTER DATABASE ps
SET RECOVERY FULL;
GO

Hope this helps.

Sunday, June 10, 2018

Quick note: How to find queries, SP's or jobs that use a linked server?

Here is the query below that can pull all above results.

Declare @VName varchar(256)
Declare Findlinked cursor
LOCAL STATIC FORWARD_ONLY READ_ONLY
     FOR
Select name
   From sys.servers
   Where is_linked = 1
      
Open Findlinked;
Fetch next from Findlinked into @VName;

while @@FETCH_STATUS = 0
Begin
   SELECT OBJECT_NAME(object_id) 
      FROM sys.sql_modules 
      WHERE Definition LIKE '%'+@VName +'%' 
      AND OBJECTPROPERTY(object_id, 'IsProcedure') = 1 ;
      
   Fetch next from Findlinked into @VName;
End

Close Findlinked
Deallocate Findlinked

SSIS Jobs are different, Here is one for SSIS jobs with Job Name and Details

Declare @VName varchar(256)
Declare Findlinked cursor
LOCAL STATIC FORWARD_ONLY READ_ONLY
     FOR
Select name AS name
   From sys.servers
   Where is_linked = 1
      
Open Findlinked;
Fetch next from Findlinked into @VName;

while @@FETCH_STATUS = 0
Begin
   SELECT OBJECT_NAME(object_id) as ProcedureName 
      FROM sys.sql_modules 
      WHERE Definition LIKE '%'+@VName +'%' 
      AND OBJECTPROPERTY(object_id, 'IsProcedure') = 1 ;
      
   Fetch next from Findlinked into @VName;
END
Close Findlinked

Open Findlinked;
Fetch next from Findlinked into @VName;

while @@FETCH_STATUS = 0
Begin
   SELECT j.name AS JobName,js.command 
      FROM msdb.dbo.sysjobsteps js
         INNER JOIN msdb.dbo.sysjobs j
            ON j.job_id = js.job_id
      WHERE js.command LIKE '%'+@VName +'%'
   Fetch next from Findlinked into @VName;
END

Close Findlinked
Deallocate Findlinked

Friday, June 08, 2018

Fun with Keyboard Shortcut Keys

  1. Ctrl+Alt+Down Arrow. This key command can magically rotate your monitor screens to 180 degrees. It would be very interesting to see someone try to log in to their PC and be surprised by an upside down screen. It would be pretty funny to see someone get dumbfounded by this shortcut. But do keep in mind is that this key only works with computers who have Intel graphics chipsets and may not work on all PCs.
  2. Left Alt + Left Shift + Print Screen. This amusing shortcut is a great way to both irritate and puzzle your friends; this command turns on the high contrast visibility setting on any computer set.
  3. Ctrl + F4. You can use this shortcut to sneak-up and wreck havoc on your pals who are working on just about any MS Office program. This shortcut immediately exits the document that is currently running and will most probably upset the victim. So be ready to run away just in case he or she gets violent.
  4. Windows + M. This command is a bit more advanced than the one above, because aside from shutting your current program, it also closes all your opened programs in a blink of an eye. Again, be ready to run or to defend yourself when executing this prank.
  5. Windows + D then Alt + F4 then press enter. This command is at the top rung when it comes to instantly closing programs. What does it do? Well, it just closes any version of windows as soon as you enter the shortcut, which makes it a very effective pal irritant.
  6. Ctrl + H. If you are at your friend’s place and have access to his or her computer, you can use this keyboard shortcut to get easy access to his or her browsing history. Be warned though, that this can reveal way too much information about your friend, so be ready for anything before trying this out.
  7. Left Alt + Left Shift then enter. This command will make your Num Lock key beep every time it is pressed. It doesn’t do any harm but it can make your friend’s computer seem broken by giving off an odd beep.
  8. Windows key + “+” then Ctrl + Alt + F. This shortcut makes your screen bigger, which can annoy users who prefer a certain screen size.
  9. PRT SC, Ctrl+V to make an unclick-able desktop. Press “Print Screen” on your keyboard (PRT SC) to make a screenshot of your desktop. Now go to Paint and Paste using (Ctrl+V). You will now have an image of your desktop which you must then save to your PC (not on your desktop) and save it as BMP. You’ll now have the file like this: C:/Desktop.bmp. Next, right-click on your desktop and select Properties. Select the tab Desktop and click Browse… Navigate to your screenshot and press OK to set it as your background. Right-click your desktop again and navigate to “Arrange icons by” and uncheck “Show desktop icons”. Your icons are now effectively unclickable, and the next user will probably give up in frustration.
  10. Windows key + “+” then windows key + “-” then Ctrl + Alt + I. This shortcut can turn the colors on your monitor screen upside down; it’s another great prank to make it seem that the computer is busted.