17.07.2015 Views

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5: <strong>FILESTREAM</strong> with ASP.NET and SilverlightUSE masterGOIF DB_ID('NorthPole') IS NOT NULLDROP DATABASE NorthPoleGOCREATE DATABASE NorthPole ON PRIMARY (NAME = NorthPole,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter5\NorthPole.mdf'), FILEGROUP NorthPole_fs CONTAINS <strong>FILESTREAM</strong>(NAME = NorthPole_fs,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter5\NorthPole_fs') LOG ON (NAME = NorthPole_log,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter5\NorthPole_log.ldf')GOListing 5-1:Rebuilding the sample NorthPole database.Listing 5-2 creates the usual Items table, with a <strong>FILESTREAM</strong> column.USE NorthPoleGOCREATE TABLE [dbo].[Items]([ItemID] INT IDENTITYPRIMARY KEY ,[ItemGuid] UNIQUEIDENTIFIER ROWGUIDCOLNOT NULLUNIQUE ,[ItemNumber] VARCHAR(20) ,[ItemDescription] VARCHAR(50) ,[ItemImage] VARBINARY(MAX) <strong>FILESTREAM</strong>NULL)GOListing 5-2:Creating the Items table.166

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!