Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

INSERT into , unique records

$
0
0

i need to run query to insert data from one table to another,

but only the unique rows, 

kindly assist, below is the query,

Insert into [Test_Audit_DB].[dbo].[New_Login_Audit]
   
SELECT
    EventName ,
        subclass_name ,
        DatabaseName ,
        DatabaseID ,
        NTDomainName ,
        ApplicationName ,
        LoginName ,
    distinct SPID ,
        StartTime ,
        RoleName ,
        TargetUserName ,
        TargetLoginName ,
        SessionLoginName
  FROM [Test_Audit_DB].[dbo].[Audit_Table]


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>