SQL Scripts for Sample .NET Page - WendyA/box-windows-sdk-v2 GitHub Wiki
These scripts create 1 table (BoxTokens) and 3 stored procedures that are used on the Sample .NET Page.
SQL Table
USE [YourDatabaseName] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO
CREATE TABLE [dbo].[BoxTokens]( [BoxTokenID] [int] IDENTITY(1,1) NOT NULL, [BoxAccessToken] varchar NOT NULL, [BoxRefreshToken] varchar NOT NULL, [Account] varchar NOT NULL, [CreateDate] [datetime] NOT NULL, [LastUpdateDate] [datetime] NOT NULL, CONSTRAINT [PK_BoxRefreshToken] PRIMARY KEY CLUSTERED ( [BoxTokenID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO
Stored Procedures
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[BoxTokenGet] @Account varchar(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; SELECT BoxAccessToken, BoxRefreshToken FROM BoxTokens WHERE Account = @Account END GO
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[BoxTokenInsert] @BoxAccessToken VARCHAR(100), @BoxRefreshToken VARCHAR(100), @Account VARCHAR(50), @CreateDate DATETIME , @LastUpdateDate DATETIME AS BEGIN SET NOCOUNT ON; INSERT INTO [YourDatabaseName].[dbo].[BoxTokens] ([BoxAccessToken] ,[BoxRefreshToken] ,[Account] ,[CreateDate] ,[LastUpdateDate]) VALUES (@BoxAccessToken ,@BoxRefreshToken ,@Account ,@CreateDate ,@LastUpdateDate) SELECT CAST(SCOPE_IDENTITY() AS int) AS LAST_IDENTITY END
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[BoxTokenUpdate] @BoxAccessToken VARCHAR(100), @BoxRefreshToken VARCHAR(100), @Account VARCHAR(50), @LastUpdateDate DATETIME AS BEGIN SET NOCOUNT ON; UPDATE [YourDatabaseName]. [dbo].[BoxTokens] SET BoxAccessToken = @BoxAccessToken, BoxRefreshToken = @BoxRefreshToken, LastUpdateDate = @LastUpdateDate WHERE Account = @Account
END