Thursday, 9 January 2020

Sql Server – Split Column With Delimited String Into Multiple Columns

Method 1: To Split A Column With Delimited String Into Multiple Columns more...

Method 2: SELECT
                       PARSENAME(REPLACE ('John,Doe', ',', '.'), 2) 'First Name',
                       PARSENAME(REPLACE ('John,Doe', ',', '.'), 1) 'Last Name'

Tuesday, 7 January 2020

Run Python with T-SQL on SSMS

1. Run the following commands in SSMS:
    sp_configure 'external scripts enabled'
    GO
    sp_configure 'external scripts enabled', 1;
    GO
    RECONFIGURE;
    GO
    sp_configure 'external scripts enabled'
    GO

2. Restart the SQL Server Service

3. Run the following command in SSMS:
    sp_configure 'external scripts enabled'
    GO

4. Test the code:
    EXEC sp_execute_external_script
    @language = N'Python',
    @script = N'print(''Hello Python !!! from T-SQL'')'

More...

Python Clear the Interpreter Console

import os
clear = lambda: os.system('cls')
clear()


Thursday, 2 January 2020

SQL Key-Value Paired Join

SELECT * FROM Tabe1 u
JOIN (
(123, 'peter6@gmail.com', 3),
(555, 'jbrown@gmail.com', 4),
(946, 'jdoe12@gmail.com', 1)
) v(EmployeeId, Email, Department)
ON (
v.Email = u.Email
and v.EmployeeId = u.EmployeeId
)


Wednesday, 27 November 2019

Enabling Non-Null Reference Types in VS Code

Add two new properties to any PropertyGroup: LangVersion and Nullable:   <PropertyGroup>         <LangVersion>8.0</LangVersion>     <Nullable>enable</Nullable>    </PropertyGroup> Enable the annotation for nullable reference types #nullable enable string? name = null;

Analysis Service in Power BI Report Server

 We couldn’t connect to the Analysis Services server. Make sure you’ve entered the connection string correctly... link