Workday and alternative

Vineet S 345 Reputation points
2024-07-16T04:34:21.7233333+00:00

Hi, I have a table which needs to duplicate with weekday and alternative create table table3 ( col1 varchar(20) , col2 varchar(20)) expected results Insert into table1 values('catch', 'catch1') Catch--------catch1-------workday catch---------catch1--------alternative

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,277 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,510 questions
SQL Server Migration Assistant
SQL Server Migration Assistant
A Microsoft tool designed to automate database migration to SQL Server from Access, DB2, MySQL, Oracle, and SAP ASE.
510 questions
0 comments No comments
{count} votes

Accepted answer
  1. LiHongMSFT-4306 25,571 Reputation points
    2024-07-16T05:57:41.2633333+00:00

    Hi @Vineet S

    Try something like this: Insert the desired result into a new table

    ;WITH CTE AS
    (
    SELECT col1, col2,'WorkDay' AS col3
    FROM table3
    UNION 
    SELECT col1, col2,'alternative'
    FROM table3
    )
    SELECT * 
    INTO NewTable
    FROM CTE
    

    Best regards,

    Cosmog


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

0 additional answers

Sort by: Most helpful