Friday, June 5, 2020

External Tables in SQL

CREATE DATABASE SCOPED CREDENTIAL sql_user_bob
WITH
     IDENTITY = 'sql_user_bob',
     SECRET = 'dtgf#45322@d343' ;
go

CREATE EXTERNAL DATA SOURCE [NameExternalDB]
WITH (TYPE = RDBMS, LOCATION = N'ExternalSerer.database.windows.net',
CREDENTIAL = [datahub_reader], DATABASE_NAME = N'ExternalDB')
GO

CREATE EXTERNAL TABLE [dbo].[dimUsers]
(
[UserId] [int] NULL,
....
)
WITH (DATA_SOURCE = [NameExternalDB] ,SCHEMA_NAME = N'common',OBJECT_NAME = N'dimUsers')
GO

Thursday, April 16, 2020

History tracking for SQL

Add history tracking to the existing table

alter table tbl_event2
add SysStartTime datetime2 generated always as row start not null default getutcdate(),
    SysEndTime   datetime2 generated always as row end   not null default convert(datetime2, '9999-12-31 23:59:59.9999999'),
    period for system_time (SysStartTime, SysEndTime);

alter table tbl_event2
  set (system_versioning = on (HISTORY_TABLE = dbo.tbl_event2_history));

Friday, April 3, 2020

PowerShell Power

Business Team was setting up a Teams channel with 250+ Partners. They reached out me saying there is not bulk upload support.  After few search I found this Power Shell support.

It was quick and the job get done.  Thanks to the Teams for enabling PowerShell.

Register-PSRepository -Name PSGalleryInt -SourceLocation https://www.poshtestgallery.com/ -InstallationPolicy Trusted
Install-Module -Name MicrosoftTeams -Repository PSGalleryInt -Force
Get-Module -Name MicrosoftTeams

Connect-MicrosoftTeams

Add-TeamUser -GroupId a51695fe-a4bf-49b0-887d-fbd60 -User "...@...com"

Add-TeamChannelUser -GroupId a51695fe-a4bf-4887d-7f79b81fbd60 -DisplayName " Events - Program Info" -User "..@...ch"

Sunday, March 29, 2020

India Election Visual

Place holder blog

It is interesting to see how the election visuals are communicated. will write more about this when I get time.









Teams PowerShell

 The PowerShell helps to get quick meta data around Teams. Install-Module -Name MicrosoftTeams Connect-MicrosoftTeams Get-TeamAllChannel...