host

DECLARE @InsertStatement NVARCHAR(MAX);


SELECT @InsertStatement = 

    'INSERT INTO SalesEmployees (Id, Name, Age) ' +

    'SELECT ' +

    STRING_AGG('''' + CAST(Id AS NVARCHAR(MAX)) + '''', ', ') +

    ' FROM Employees WHERE Department = ''Sales'';'

FROM Employees

WHERE Department = 'Sales';


PRINT @InsertStatement;


Comments

Popular posts from this blog

Steps to create SSH key from git bash

requirement.txt