This repository has been archived by the owner on Oct 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAmazonToAzureDataConversion.sql
14 lines (14 loc) · 2.93 KB
/
AmazonToAzureDataConversion.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
select 'INSERT INTO [stirlingmoney].[categories] (categoryId, editDateTime, categoryName, appSyncId) VALUES (''' + ISNULL(CONVERT(NVARCHAR(MAX), [categoryId]), 'NULL') + ''',''' + CONVERT(NVARCHAR(MAX), SYSDATETIMEOFFSET()) + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX), [categoryName]), 'NULL') + ''',''' + 'f0a30ccc-7867-4af5-99ea-07976eee3451' +''');' [sql]
from Category
UNION
select 'INSERT INTO [stirlingmoney].[accounts] (accountId, editDateTime, accountName, initialBalance, appSyncId) VALUES (''' + ISNULL(CONVERT(NVARCHAR(MAX),[accountId]), 'NULL') + ''',''' + CONVERT(NVARCHAR(MAX), SYSDATETIMEOFFSET()) + ''',''' + [accountName] + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[initialBalance]), 'NULL') + ''',''' + 'f0a30ccc-7867-4af5-99ea-07976eee3451' +''');' [sql]
from Account
UNION
select 'INSERT INTO [stirlingmoney].[budgets] (budgetId, editDateTime, budgetName, budgetAmount, categoryId, budgetPeriod, startDate, endDate, appSyncId) VALUES (''' + CONVERT(NVARCHAR(MAX),[BudgetId]) + ''',''' + CONVERT(NVARCHAR(MAX), SYSDATETIMEOFFSET()) + ''',''' + [budgetName] + ''',''' + CONVERT(NVARCHAR(MAX),[budgetAmount]) + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[categoryId]), 'NULL') + ''',''' + CONVERT(NVARCHAR(MAX),[budgetPeriod]) + ''',''' + CONVERT(NVARCHAR(MAX),[startDate]) + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[endDate]), 'NULL') + ''',''' + 'f0a30ccc-7867-4af5-99ea-07976eee3451' +''');' [sql]
from Budget
UNION
select 'INSERT INTO [stirlingmoney].[goals] (goalId, editDateTime, goalName, amount, accountId, initialBalance, targetDate, startDate, appSyncId) VALUES (''' + ISNULL(CONVERT(NVARCHAR(MAX),[goalId]), 'NULL') + ''',''' + CONVERT(NVARCHAR(MAX), SYSDATETIMEOFFSET()) + ''',''' + [goalName] + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[amount]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[_accountId]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[InitialBalance]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[targetDate]), 'NULL') + ''',''' + CONVERT(NVARCHAR(MAX),SYSDATETIMEOFFSET()) + ''',''' + 'f0a30ccc-7867-4af5-99ea-07976eee3451' +''');' [sql]
from Goal
UNION
select 'INSERT INTO [stirlingmoney].[transactions] (transactionId, editDateTime, transactionDate, amount, location, note, posted, checkNumber, accountId, categoryId, appSyncId) VALUES (''' + ISNULL(CONVERT(NVARCHAR(MAX),[transactionId]), 'NULL') + ''',''' + CONVERT(NVARCHAR(MAX), SYSDATETIMEOFFSET()) + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[transactionDate]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[amount]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[location]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[note]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[posted]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[checkNumber]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[_accountId]), 'NULL') + ''',''' + ISNULL(CONVERT(NVARCHAR(MAX),[CategoryId]), 'NULL') + ''',''' + 'f0a30ccc-7867-4af5-99ea-07976eee3451' +''');' [sql]
from [Transaction]