1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
|
DECLARE curTempClients CURSOR FOR
SELECT "Full Name",
"Address",
"Phone Number (H)",
"Phone Number (W)",
"Notes",
"Status",
"Email Address",
"Consultant",
CAST("Related Company" AS INT),
"Title",
"Mobile Number",
CAST("Date of Birth" AS DATETIME),
"Nationality",
"Marital Status",
"Name of Spouse/Partner",
"Spouse/Partner Visa Status",
"Any of you Previous Divorce",
"Spouse/Partner Apply With",
"Children Apply With",
CAST("Applications" AS INT),
"Referred By",
CAST(CAST("Total Our Fee" AS MONEY) AS DECIMAL(12,2)),
CAST("Related Enquiry" AS INT),
CAST("Record ID#" AS INT)
FROM TempClients
DECLARE @FullName varchar(100)
DECLARE @Address varchar(1000)
DECLARE @HomeNumber varchar(100)
DECLARE @WorkNumber varchar(100)
DECLARE @Notes varchar(2000)
DECLARE @Status varchar(100)
DECLARE @Email varchar(100)
DECLARE @Consultant varchar(100)
DECLARE @RelatedCompany int
DECLARE @Title varchar(100)
DECLARE @MobileNumber varchar(100)
DECLARE @DOB datetime
DECLARE @Nationality varchar(100)
DECLARE @MaritalStatus varchar(100)
DECLARE @SpouseName varchar(100)
DECLARE @SpouseVisa varchar(100)
DECLARE @Divorce varchar(100)
DECLARE @SpouseApplyWith varchar(100)
DECLARE @ChildrenApplyWIth varchar(100)
DECLARE @Applications int
DECLARE @ReferredBy varchar(100)
DECLARE @TotalOurFee decimal
DECLARE @RelatedEnquiry int
DECLARE @RecordId int
OPEN curTempClients
FETCH NEXT FROM curTempClients
INTO @FullName, @Address, @HomeNumber, @WorkNumber, @Notes, @Status, @Email, @Consultant, @RelatedCompany, @Title, @MobileNumber,
@DOB, @Nationality, @MaritalStatus, @SpouseName, @SpouseVisa, @Divorce, @SpouseApplyWith, @ChildrenApplyWIth, @Applications,
@ReferredBy, @TotalOurFee, @RelatedEnquiry, @RecordId
WHILE (@@FETCH_STATUS = 0)
BEGIN
PRINT 'Full Name: ' + @FullName
FETCH NEXT FROM curTempClients
INTO @FullName, @Address, @HomeNumber, @WorkNumber, @Notes, @Status, @Email, @Consultant, @RelatedCompany, @Title, @MobileNumber,
@DOB, @Nationality, @MaritalStatus, @SpouseName, @SpouseVisa, @Divorce, @SpouseApplyWith, @ChildrenApplyWIth, @Applications,
@ReferredBy, @TotalOurFee, @RelatedEnquiry, @RecordId
END
CLOSE curTempClients
DEALLOCATE curTempClients
GO
|