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 10: Integrating <strong>FILESTREAM</strong> with other <strong>SQL</strong> <strong>Server</strong> FeaturesGOINSERT INTO Items( ItemID ,ItemNumber ,ItemDescription ,ItemImage)SELECT NEWID() ,'MS1001' ,'Micros<strong>of</strong>t Mouse' ,bulkcolumnFROM OPENROWSET(BULK 'C:\temp\Micros<strong>of</strong>tMouse.jpg',SINGLE_BLOB) AS xListing 10-19: Creating a <strong>FILESTREAM</strong>-enabled database to test CDC.<strong>The</strong> next step is to enable CDC by running the CDC system stored procedures(Listing 10-20).USE NorthPoleGO-- Enable CDC on the NorthPole databaseEXEC sys.sp_cdc_enable_db-- Enable CDC on the Items tableEXEC sys.sp_cdc_enable_table @source_schema = 'dbo',@source_name = 'items',@role_name = 'cdc_items',@supports_net_changes = 0Listing 10-20: Enabling CDC on a table.Note that you need to have the <strong>SQL</strong> <strong>Server</strong> Agent service running to have the CDC datacaptured. If <strong>SQL</strong> Agent is not running, you will not see the data until you run <strong>SQL</strong> Agentand the capture jobs populate CDC tables with the data. To verify if the <strong>SQL</strong> <strong>Server</strong> Agentservice is running, open Control Panel | Administrative Tools | Services. Scroll down thelist <strong>of</strong> services until you see the <strong>SQL</strong> <strong>Server</strong> Agent service for your instance (the instance379

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

Saved successfully!

Ooh no, something went wrong!