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> FeaturesBIGINT value, perform the required bitwise operation and then convert the new value toa VARBINARY so that a string representation <strong>of</strong> the hex value can be created from that, asshown in Listing 10-5.DECLARE@options VARBINARY(8),@prev BIGINT-- Set the flag to replicate <strong>FILESTREAM</strong> flag using a bitwise OR-- We'll assume that the previous value is 0x000000000803509FSELECT @prev = 0x000000000803509FSELECT @prev = @prev | 0x100000000SELECT @options = CAST(@prev AS VARBINARY(8))SELECT @options-- Original Value: 0x000000000803509F-- New Value : 0x000000010803509F-- Note the flag : ---------^--------Listing 10-5:Turning the <strong>FILESTREAM</strong> replication flag on by performing a bitwise OR operation.To turn <strong>of</strong>f the <strong>FILESTREAM</strong> replication flag, we need to run the reverse operation and toclear a specific bit in the configuration value using a bitwise NOT operation. Listing 10-6shows how to do this.DECLARE@options VARBINARY(8),@prev BIGINT-- Clear the <strong>FILESTREAM</strong> repl flag using a bitwise NOT operation-- We'll assume that the previous value is 0x000000010803509FSELECT @prev = 0x000000010803509FSELECT @prev = @prev ^ 0x100000000SELECT @options = CAST(@prev AS VARBINARY(8))SELECT @options-- Original Value: 0x000000010803509F-- New Value : 0x000000000803509F-- Note the flag : ---------^--------Listing 10-6:Turning the <strong>FILESTREAM</strong> replication flag <strong>of</strong>f by performing a bitwise NOT operation.363

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

Saved successfully!

Ooh no, something went wrong!