Here is my code:
DELETE FROM [ENROLLMENT].[dbo].[Process]
DECLARE @socnums varchar(25)
DECLARE @doctype varchar(10)
DECLARE @sigdate datetime
DECLARE @fundnum varchar(10)
DECLARE @create_date datetime
DECLARE @memberno varchar(25)
DECLARE the_cursor CURSOR FOR
SELECT ID_1006, ID_1007, ID_1015, ID_1002, ID_502, ID_1005 FROM ELVIS.EP3_14
WHERE ISNUMERIC(ID_1005) = 1
and ID_12 > -1
ORDER BY ID_1005 ASC,
ID_1015 ASC
OPEN the_cursor
FETCH NEXT FROM the_cursor into @socnums, @doctype, @sigdate, @fundnum, @create_date, @memberno
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO [ENROLLMENT].[DBO].[Process] (SSN, DOCTYPE, SIGDATE, FUNDNUM,
CREATE_DATE, MEMBERNO)
VALUES(@SOCNUMS, @DOCTYPE, @SIGDATE, @FUNDNUM, @CREATE_DATE, @MEMBERNO)
FETCH NEXT FROM the_cursor into @socnums,@doctype,@sigdate,@fundnum,@create_date,@memberno
END
CLOSE the_cursor
DEALLOCATE the_cursor
GO
I am trying to populate a table that I use as a file on the mainframe. I wanted to sort the table the same way a file I will be comparing it to on the mainframe is sorted. I view the table, and for some reason it is not sorted ascending by ID_1005, and then ID_1015. The results look partially sorted. Can anyone offer any assistance? Can I sort the table later with another program?
DELETE FROM [ENROLLMENT].[dbo].[Process]
DECLARE @socnums varchar(25)
DECLARE @doctype varchar(10)
DECLARE @sigdate datetime
DECLARE @fundnum varchar(10)
DECLARE @create_date datetime
DECLARE @memberno varchar(25)
DECLARE the_cursor CURSOR FOR
SELECT ID_1006, ID_1007, ID_1015, ID_1002, ID_502, ID_1005 FROM ELVIS.EP3_14
WHERE ISNUMERIC(ID_1005) = 1
and ID_12 > -1
ORDER BY ID_1005 ASC,
ID_1015 ASC
OPEN the_cursor
FETCH NEXT FROM the_cursor into @socnums, @doctype, @sigdate, @fundnum, @create_date, @memberno
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO [ENROLLMENT].[DBO].[Process] (SSN, DOCTYPE, SIGDATE, FUNDNUM,
CREATE_DATE, MEMBERNO)
VALUES(@SOCNUMS, @DOCTYPE, @SIGDATE, @FUNDNUM, @CREATE_DATE, @MEMBERNO)
FETCH NEXT FROM the_cursor into @socnums,@doctype,@sigdate,@fundnum,@create_date,@memberno
END
CLOSE the_cursor
DEALLOCATE the_cursor
GO
I am trying to populate a table that I use as a file on the mainframe. I wanted to sort the table the same way a file I will be comparing it to on the mainframe is sorted. I view the table, and for some reason it is not sorted ascending by ID_1005, and then ID_1015. The results look partially sorted. Can anyone offer any assistance? Can I sort the table later with another program?