September 11, 2014 at 2:11 pm
DECLARE @EmployeeID nvarchar(1000)
DECLARE @FiscalYear nvarchar(1000)
SET @EmployeeID = '101,102,103,104,105'
SET @FiscalYear = '2013,2014'
SELECT Data FROM dbo.Split(@EmployeeID, ',')
SELECT Data FROM dbo.Split(@fiscalyear, ',')
_______________________________________
This is part of a bigger project but I am stuck on this part. I get back 2 result sets
Data Data
101 2013
102 2014
103
104
105
I wants to insert the results in a new table 2 columns and get the rsults below.
New Table
ID Fiscal Year
101 2013
101 2014
102 2013
102 2014
103 2013
103 2014
104 2013
104 2014
105 2013
105 2014
September 11, 2014 at 2:46 pm
That's fairly easy
SELECT e.Data AS ID, y.Data AS FiscalYear
FROM dbo.Split(@EmployeeID, ',') e CROSS JOIN dbo.Split(@fiscalyear, ',') y
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 11, 2014 at 2:50 pm
TY that worked I dont know why that was causing me such a problem. Now that I see the answer it was easy.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply