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 7: <strong>FILESTREAM</strong> Database AdministrationCREATE DATABASE NorthPole ON PRIMARY (NAME = NorthPole,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole.mdf'), FILEGROUP NorthPole_fs CONTAINS <strong>FILESTREAM</strong>(NAME = NorthPole_fs,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole_fs') LOG ON (NAME = NorthPole_log,FILENAME = 'C:\<strong>Art</strong>OfFS\Demos\Chapter7\NorthPole_log.ldf')GOUSE NorthPoleGOCREATE TABLE [dbo].[Items]([ItemID] UNIQUEIDENTIFIER ROWGUIDCOLNOT NULLUNIQUE ,[ItemNumber] VARCHAR(20) ,[ItemDescription] VARCHAR(50) ,[ItemImage1] VARBINARY(MAX) <strong>FILESTREAM</strong>NULL ,[ItemImage2] VARBINARY(MAX) <strong>FILESTREAM</strong>NULL)Listing 7-6:Creating an example database with two <strong>FILESTREAM</strong> columns.Now we'll insert a row into the <strong>FILESTREAM</strong> table (Listing 7-7).INSERT INTO Items( ItemID ,ItemNumber ,ItemDescription ,ItemImage1 ,ItemImage2)SELECT NEWID() ,'MS1001' ,'Micros<strong>of</strong>t Mouse' ,0x1 ,0x1Listing 7-7:Inserting a row into the table.281

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

Saved successfully!

Ooh no, something went wrong!