?
Solved

EXCEL MATH TO SQL

Posted on 2011-10-25
7
Medium Priority
?
319 Views
Last Modified: 2012-05-12
Hi All,

I have below excel math :

=FLOOR(LOG(Number,2),1)+1

How to convert it into MS SQL ?

Thank you.
0
Comment
Question by:emi_sastra
  • 4
  • 3
7 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 37029065
floor(log(number)/log(2))+1
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 37029066
you could also use log10  instead of log

0
 
LVL 1

Author Comment

by:emi_sastra
ID: 37029093
Hi sdstuber,

 - floor(log(number)/log(2))+1
It works.

- you could also use log10  instead of log
How to do this ?

Thank you.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 74

Expert Comment

by:sdstuber
ID: 37029098
floor(log10(number)/log10(2))+1
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 37029105
What makes it different ?

Would you please make correction of my code below ?

SELECT FLOOR(LOG(
SELECT COUNT(*) AS TotalMember
FROM TMMEMBERDATA) / LOG(2))+1

Thank you.
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 37029110
select floor(log(count(*))/log(2))+1 from tmmemberdata
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 37029118
Great.

Thank you very much for your help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

839 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