Search

Tutorials, tips&tricks, snippets..

K.I.S.S.: Keep It Simple, Stupid!

Fast and useful hint to analyze your disk usage

Just click here and discover the power of WinDirStat. If you have a full disk to clean up, this will be your savior.

Send push notification using C# and FCM

After you set up the environment in your app and make it able to receive push notifications, here we’ll see how to send these push notifications using the FCM features with C#.

Continue reading “Send push notification using C# and FCM”

DevExtreme/Phonegap: how to manage push notifications with FCM

It took long time for me to manage in the correct way push notifications within my app. Using DevExtreme, I’m able to create a single app both for Android and iOS.

To test the push notifications feature, I use FCM (Firebase Cloud Messaging, by Google).

Continue reading “DevExtreme/Phonegap: how to manage push notifications with FCM”

Enable/disable foreign keys check Azure SQL database

The classic commad working in SQL Server

EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"

isn’t working on Azure database.

Here the code to disable the foreign keys on all the table of a database:

DECLARE @enable_constraints bit = 0

--Don't change anything below this line.
DECLARE @schema_name SYSNAME
DECLARE @table_name  SYSNAME

DECLARE table_cursor CURSOR FOR
SELECT
    schemas.name,
    tables.name
FROM
    sys.tables
    INNER JOIN sys.schemas ON tables.schema_id = schemas.schema_id

OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @schema_name, @table_name

DECLARE @cmd varchar(200) 
WHILE @@FETCH_STATUS = 0
BEGIN
    SET @cmd = 'ALTER TABLE ' + QUOTENAME(@schema_name) + '.' + QUOTENAME(@table_name) + ' '
    SET @cmd = @cmd + (CASE WHEN @enable_constraints = 1 THEN 'CHECK' ELSE 'NOCHECK' END) + ' CONSTRAINT ALL'

    PRINT @cmd
    EXEC( @cmd )

    FETCH NEXT FROM table_cursor INTO @schema_name, @table_name
END

CLOSE table_cursor
DEALLOCATE table_cursor

To enable them again, just change the firs row with

DECLARE @enable_constraints bit = 0

Enable/disable foreign keys check

When you do some stuff on your database, it can be useful disable, for a while, the foreign keys check. Here how to do it:
Continue reading “Enable/disable foreign keys check”

How to Fix the Error “Could not find the Database Engine startup handle” in SQL Server 2016, 2014, or 2008

Just go here to solve this problem.

Find duplicate records with a query

Duplicate data often creeps in when multiple users add data to the database at the same time or if the database wasn’t designed to check for duplicates. Duplicate data can be either multiple tables containing the same data or two records containing just some fields (columns) with similar data. Here’s how you can locate duplicate records for a desktop database.

To find duplicate records:

  1. On the Create tab, click Query Wizard.
  2. In the New Query dialog, click Find Duplicates Query Wizard > OK.
  3. In the list of tables, select the table you want to use and click Next.
  4. Select the fields that you want to match and click Next.
  5. In the list of available fields, select the field or fields that contain the data that you want to update and click Next.
  6. Accept the suggested query name or enter a name, and click Finish to run the query.

CopyDatabaseWizard version error

This morning I found this annoying message in Event Viewer of my machine where I have a SQL Instance:

Activation context generation failed for “c:\program files (x86)\microsoft sql server\120\Tools\Binn\managementstudio\CopyDatabaseWizard.exe”.Error in manifest or policy file “c:\program files (x86)\microsoft sql server\120\Tools\Binn\managementstudio\CopyDatabaseWizard.exe” on line 8. The value “1.0” of attribute “version” in element “assemblyIdentity” is invalid.

A quick solution is:

Continue reading “CopyDatabaseWizard version error”

What is the difference between Public, Private and Protected?

We always see the Access Modifiers in our code, but do we really know them?

Continue reading “What is the difference between Public, Private and Protected?”

Create a free website or blog at WordPress.com.

Up ↑