Unix Technical Forum

Formula column.

This is a discussion on Formula column. within the SQL Server forums, part of the Microsoft SQL Server category; --> HI, I have a problem in formula column. I have 8 1 bit varibles in a table for ex: ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 05:39 PM
Venkat
 
Posts: n/a
Default Formula column.

HI,
I have a problem in formula column.
I have 8 1 bit varibles in a table
for ex: Flag1, falg2, flag3 ...Flag8
Now I want to create another variable as a small integer and copy all
the flgas to that field.
For ex:

(flag1 << 0x80) | (flag2 << 0x40) | ..... | flag8

I tried all possible ways?

Let me know how to write the formula for this column.

Thanks,
Venkat.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 05:40 PM
David Portas
 
Posts: n/a
Default Re: Formula column.

Assuming you don't have any NULLs:

(flag1*128 | flag2*64 | flag3*32 | flag4*16 | flag5*8 | flag6*4 | flag7*2 |
flag8*1)

--
David Portas
------------
Please reply only to the newsgroup
--

"Venkat" <arunkvrr@yahoo.com> wrote in message
news:f21476c8.0308281543.145ceff9@posting.google.c om...
> HI,
> I have a problem in formula column.
> I have 8 1 bit varibles in a table
> for ex: Flag1, falg2, flag3 ...Flag8
> Now I want to create another variable as a small integer and copy all
> the flgas to that field.
> For ex:
>
> (flag1 << 0x80) | (flag2 << 0x40) | ..... | flag8
>
> I tried all possible ways?
>
> Let me know how to write the formula for this column.
>
> Thanks,
> Venkat.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:39 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com