I have a fully working stored procedure grabbing data from different tables using joins. I am currently using the below SELECT statement to select the data I require:
SELECT ClientReference, ReferenceNumber, Text3, ReceiptDate, [dbo].[Complaint].[Description], ActionTaken, dbo.Category.Name, dbo.CategoryOption.FullName, dbo.Complaint.AuditCreatedBy, dbo.UserGroup.Name, dbo.Complaint.LoggedByUserId, dbo.Complaint.LoggedByTime FROM dbo.Complaint Now what I want to be able to do is insert this data into a temporary table. However, INSERT INTO does not work as I have two columns (resulting from my join) called Name.
How would I go about solving this?
SELECT ... INTO #temp ..?SELECTstatement. I assume there's more to it?