Solved

status2 value 'not in the book'

Posted on 2010-08-17
11
604 Views
Last Modified: 2012-05-10
my database shows a status2 value of 1090519040. But in http://msdn.microsoft.com/en-us/library/aa260406%28SQL.80%29.aspx i do not see such a value- how do you interpret it then?

thanks
0
Comment
Question by:anushahanna
  • 5
  • 4
  • 2
11 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 100 total points
ID: 33457677
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33457828
still do not see 1090519040 in that page? would you expect me to see it?
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 33458365
Case status2 & 1090519040 when 1090519040 then 1 else 0 end.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 400 total points
ID: 33459973
>> still do not see 1090519040 in that page? would you expect me to see it? <<

No.  That is the combination of two different bit values being set:

1073741824
16777216

Unfortunately, BOL doesn't document the meanings of those two particular bits.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33464485
>>That is the combination of two different bit values being set

can you pl explain how that works..
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 400 total points
ID: 33470149
In SQL an integer is signed, and is 4 bytes, thus 31 bits.

Each bit can be on or off, of course, and has its own unique value.  Off is always 0.  On is by power of two, like so:
Bit0 = 1; Bit1 = 2; Bit3 = 4; Bit4 = 8; etc.

So, say bits 1 and 4 were on ... the field would contain 10 ( 2 + 8 ) .

Note that no bits ever overlap, even when added up.  That is, the sum of all preceding bits is always one less than the current bit.  (For example, Bit5 = 16; the sum of all earlier bits being on is 15).

Thus, you can always tell which individual bits are on and which are on in a given total value for the integer.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33477387
very helpful explanation. thanks scott.

in this reference, can you show how does 1073741824 & 16777216 result in 1090519040
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 400 total points
ID: 33487937
Add them:

1073741824 + 16777216 = 1090519040

That means no other bits are on, or the value would be higher.  Each bit on increases the value of the integer column.

0
 
LVL 6

Author Comment

by:anushahanna
ID: 33502010
OK. Many thanks Scott.

But, on the first hand, how did you quickly discern the 2 numbers.
16777216 is also not in that reference.

do you know these numbers just by experience?

and 1073741824 is in status column. So that means these values float between status and status2?
0
 
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 400 total points
ID: 33502481
>> do you know these numbers just by experience? <<

Nah.  I just kept using power of 2 values, then did a quick test to see if they were present :-) .


0
 
LVL 6

Author Comment

by:anushahanna
ID: 33507128
that makes a brilliant expert! Thanks Scott! You always have an extra insight into things - simple yet quiet impact-ful.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question