1

I am using the table sysschemaarticles to collect information in my transactional replication.

It is used for a variety of things including adding new articles and finding out who are the subscriber Servers.

this script needs to be run in the publication database.

SELECT 
 PublisherDB=db_name() 
,PublisherName=sp.name
,The_Type=so.type_desc
,The_Schema=schema_name(so.schema_id)
,The_Object=sa.name
,SubscriberServerName=UPPER(srv.srvname) 
,so.is_schema_published
,so.is_published
,sa.schema_option
from dbo.syspublications sp 
INNER JOIN dbo.sysschemaarticles sa on sp.pubid = sa.pubid 
INNER JOIN sys.objects so on sa.objid = so.object_id
INNER JOIN dbo.syssubscriptions s on sa.artid = s.artid 
INNER JOIN master.dbo.sysservers srv on s.srvid = srv.srvid 

enter image description here

However the schema_option has different options that can be associated with it, and I would like to figure out ALL of them.

You can see the possible options on the picture below.

enter image description here

How can I get ALL the values stored in a binary(8) field?

I believe there could be a combination of options in this case.

Hannah Vernon
71.1k22 gold badges178 silver badges324 bronze badges
asked Jul 30, 2015 at 11:15

1 Answer 1

2

Use the built-in bitwise operators to examine the column. For example

select
 schema_option & 0x01 AS GeneratesObjectCreation,
 schema_option & 0x02 AS GenerateCustomSP,
... etc.
answered Jul 30, 2015 at 11:30
1
  • This results in the following Msg 402, Level 16, State 1, Line 62 The data types binary and varbinary are incompatible in the '&' operator. Commented Jun 21, 2018 at 16:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.