Showing posts with label convert. Show all posts
Showing posts with label convert. Show all posts

Friday, March 23, 2012

Mega / GIga

Hi Friends,
How can i transform the following query to return size in
Gigabytes ?
str(sum(convert(dec(15),v.size))* 8192 / 1048576,10,2)+'MB'
thx
Johnny
Divide by 1024?
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Johnny" <johnny_silvestre@.yahoo.de> wrote in message
news:942601c4339b$9a47f110$a401280a@.phx.gbl...
> Hi Friends,
> How can i transform the following query to return size in
> Gigabytes ?
> str(sum(convert(dec(15),v.size))* 8192 / 1048576,10,2)+'MB'
> thx
> Johnny
|||divide by 1024

Mega / GIga

Hi Friends,
How can i transform the following query to return size in
Gigabytes ?
str(sum(convert(dec(15),v.size))* 8192 / 1048576,10,2)+'MB'
thx
JohnnyDivide by 1024?
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Johnny" <johnny_silvestre@.yahoo.de> wrote in message
news:942601c4339b$9a47f110$a401280a@.phx.gbl...
> Hi Friends,
> How can i transform the following query to return size in
> Gigabytes ?
> str(sum(convert(dec(15),v.size))* 8192 / 1048576,10,2)+'MB'
> thx
> Johnny|||divide by 1024

Mega / GIga

Hi Friends,
How can i transform the following query to return size in
Gigabytes ?
str(sum(convert(dec(15),v.size))* 8192 / 1048576,10,2)+'MB'
thx
JohnnyDivide by 1024?
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Johnny" <johnny_silvestre@.yahoo.de> wrote in message
news:942601c4339b$9a47f110$a401280a@.phx.gbl...
> Hi Friends,
> How can i transform the following query to return size in
> Gigabytes ?
> str(sum(convert(dec(15),v.size))* 8192 / 1048576,10,2)+'MB'
> thx
> Johnny|||divide by 1024

Wednesday, March 21, 2012

measurement conversion

I am looking for a query that will convert inches into feet:
Here is what I have:
SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
Panelstatus, CompletedDT FROM panel
WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
and panelstatus='C'
order by completeddt
The height and Lenght are returned as:
Height Length
93.0 25.375
I want those values returned as feet. I'm seeing that I need to apply *12 to
a delcare statment, but not sure how to format the query.
I do not need to display the inches, just round the total footage up.
any help is appreciated.
Hi,UseROUND ( numeric_expression , length [ , function ] )
Where the numeric_expression is the number you want to round, length is the
number of characters to leave while rounding to the right or left of the
decimal point. If the length is positive, then numbers are rounded to the
right of the decimal point, where as when the length is negative then
numbers are rounded to the left of the decimal point. The function parameter
is optional. This parameter determines whether the ROUND function will round
or truncate the numeric_expression. If the function parameter is a zero (0),
the default, then rounding will occur; any other value for this parameter
will cause the ROUND function to truncate the numeric_expression.
SELECT Orderid, Bundlename, PanelID, Linenumber, Round(Height,0),
Round(Length,0) .....
Igor B
"Steve T." <stornari@.nvrinc.com> wrote in message
news:OK0ArxuiEHA.3172@.tk2msftngp13.phx.gbl...
>I am looking for a query that will convert inches into feet:
> Here is what I have:
> SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> The height and Lenght are returned as:
> Height Length
> 93.0 25.375
> I want those values returned as feet. I'm seeing that I need to apply *12
> to
> a delcare statment, but not sure how to format the query.
> I do not need to display the inches, just round the total footage up.
> any help is appreciated.
>

Measurement conversion

I am looking for a query that will convert inches into feet:
Here is what I have:
SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
Panelstatus, CompletedDT FROM panel
WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
and panelstatus='C'
order by completeddt
The height and Lenght are returned as:
Height Length
93.0 25.375
I want those values returned as feet. I'm seeing that I need to apply *12 to
a delcare statment, but not sure how to format the query.
I do not need to display the inches, just round the total footage up.
any help is appreciated."Steve T." <stornari@.nvrinc.com> wrote in message
news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
> I am looking for a query that will convert inches into feet:
> Here is what I have:
> SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> The height and Lenght are returned as:
> Height Length
> 93.0 25.375
> I want those values returned as feet. I'm seeing that I need to apply *12
to
> a delcare statment, but not sure how to format the query.
> I do not need to display the inches, just round the total footage up.
> any help is appreciated.
>|||Oops, hit send too quickly last time...
This will round up the calculation if the precision of the number of feet is
greater than 0.0009; else, it will round down... If you want to make it
round up more often, just change the 0.499:
SELECT Orderid, Bundlename, PanelID, Linenumber,
ROUND((Height/12.0) + 0.499, 0) AS Height,
ROUND((Length/12.0) + 0.499, 0) AS Length,
Panelstatus, CompletedDT FROM panel
WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
and panelstatus='C'
order by completeddt
"Steve T." <stornari@.nvrinc.com> wrote in message
news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
> I am looking for a query that will convert inches into feet:
> Here is what I have:
> SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> The height and Lenght are returned as:
> Height Length
> 93.0 25.375
> I want those values returned as feet. I'm seeing that I need to apply *12
to
> a delcare statment, but not sure how to format the query.
> I do not need to display the inches, just round the total footage up.
> any help is appreciated.
>|||Adam,
Thank you very much.
This will be very helpful.
Thanks again,
Steve
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:OoFiE2uiEHA.3476@.tk2msftngp13.phx.gbl...
> Oops, hit send too quickly last time...
> This will round up the calculation if the precision of the number of feet
is
> greater than 0.0009; else, it will round down... If you want to make it
> round up more often, just change the 0.499:
>
> SELECT Orderid, Bundlename, PanelID, Linenumber,
> ROUND((Height/12.0) + 0.499, 0) AS Height,
> ROUND((Length/12.0) + 0.499, 0) AS Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> "Steve T." <stornari@.nvrinc.com> wrote in message
> news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
*12[vbcol=seagreen]
> to
>

Measurement conversion

I am looking for a query that will convert inches into feet:
Here is what I have:
SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
Panelstatus, CompletedDT FROM panel
WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
and panelstatus='C'
order by completeddt
The height and Lenght are returned as:
Height Length
93.0 25.375
I want those values returned as feet. I'm seeing that I need to apply *12 to
a delcare statment, but not sure how to format the query.
I do not need to display the inches, just round the total footage up.
any help is appreciated.
"Steve T." <stornari@.nvrinc.com> wrote in message
news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
> I am looking for a query that will convert inches into feet:
> Here is what I have:
> SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> The height and Lenght are returned as:
> Height Length
> 93.0 25.375
> I want those values returned as feet. I'm seeing that I need to apply *12
to
> a delcare statment, but not sure how to format the query.
> I do not need to display the inches, just round the total footage up.
> any help is appreciated.
>
|||Oops, hit send too quickly last time...
This will round up the calculation if the precision of the number of feet is
greater than 0.0009; else, it will round down... If you want to make it
round up more often, just change the 0.499:
SELECT Orderid, Bundlename, PanelID, Linenumber,
ROUND((Height/12.0) + 0.499, 0) AS Height,
ROUND((Length/12.0) + 0.499, 0) AS Length,
Panelstatus, CompletedDT FROM panel
WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
and panelstatus='C'
order by completeddt
"Steve T." <stornari@.nvrinc.com> wrote in message
news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
> I am looking for a query that will convert inches into feet:
> Here is what I have:
> SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> The height and Lenght are returned as:
> Height Length
> 93.0 25.375
> I want those values returned as feet. I'm seeing that I need to apply *12
to
> a delcare statment, but not sure how to format the query.
> I do not need to display the inches, just round the total footage up.
> any help is appreciated.
>
|||Adam,
Thank you very much.
This will be very helpful.
Thanks again,
Steve
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:OoFiE2uiEHA.3476@.tk2msftngp13.phx.gbl...
> Oops, hit send too quickly last time...
> This will round up the calculation if the precision of the number of feet
is[vbcol=seagreen]
> greater than 0.0009; else, it will round down... If you want to make it
> round up more often, just change the 0.499:
>
> SELECT Orderid, Bundlename, PanelID, Linenumber,
> ROUND((Height/12.0) + 0.499, 0) AS Height,
> ROUND((Length/12.0) + 0.499, 0) AS Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> "Steve T." <stornari@.nvrinc.com> wrote in message
> news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
*12
> to
>

Measurement conversion

I am looking for a query that will convert inches into feet:
Here is what I have:
SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
Panelstatus, CompletedDT FROM panel
WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
and panelstatus='C'
order by completeddt
The height and Lenght are returned as:
Height Length
93.0 25.375
I want those values returned as feet. I'm seeing that I need to apply *12 to
a delcare statment, but not sure how to format the query.
I do not need to display the inches, just round the total footage up.
any help is appreciated."Steve T." <stornari@.nvrinc.com> wrote in message
news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
> I am looking for a query that will convert inches into feet:
> Here is what I have:
> SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> The height and Lenght are returned as:
> Height Length
> 93.0 25.375
> I want those values returned as feet. I'm seeing that I need to apply *12
to
> a delcare statment, but not sure how to format the query.
> I do not need to display the inches, just round the total footage up.
> any help is appreciated.
>|||Oops, hit send too quickly last time...
This will round up the calculation if the precision of the number of feet is
greater than 0.0009; else, it will round down... If you want to make it
round up more often, just change the 0.499:
SELECT Orderid, Bundlename, PanelID, Linenumber,
ROUND((Height/12.0) + 0.499, 0) AS Height,
ROUND((Length/12.0) + 0.499, 0) AS Length,
Panelstatus, CompletedDT FROM panel
WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
and panelstatus='C'
order by completeddt
"Steve T." <stornari@.nvrinc.com> wrote in message
news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
> I am looking for a query that will convert inches into feet:
> Here is what I have:
> SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> The height and Lenght are returned as:
> Height Length
> 93.0 25.375
> I want those values returned as feet. I'm seeing that I need to apply *12
to
> a delcare statment, but not sure how to format the query.
> I do not need to display the inches, just round the total footage up.
> any help is appreciated.
>|||Adam,
Thank you very much.
This will be very helpful.
Thanks again,
Steve
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:OoFiE2uiEHA.3476@.tk2msftngp13.phx.gbl...
> Oops, hit send too quickly last time...
> This will round up the calculation if the precision of the number of feet
is
> greater than 0.0009; else, it will round down... If you want to make it
> round up more often, just change the 0.499:
>
> SELECT Orderid, Bundlename, PanelID, Linenumber,
> ROUND((Height/12.0) + 0.499, 0) AS Height,
> ROUND((Length/12.0) + 0.499, 0) AS Length,
> Panelstatus, CompletedDT FROM panel
> WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> and panelstatus='C'
> order by completeddt
> "Steve T." <stornari@.nvrinc.com> wrote in message
> news:OhQVqwuiEHA.3896@.TK2MSFTNGP15.phx.gbl...
> > I am looking for a query that will convert inches into feet:
> > Here is what I have:
> >
> > SELECT Orderid, Bundlename, PanelID, Linenumber, Height, Length,
> > Panelstatus, CompletedDT FROM panel
> > WHERE completedDT BETWEEN '2004-08-25 06:00' AND '2004-08-25 17:00'
> > and panelstatus='C'
> > order by completeddt
> >
> > The height and Lenght are returned as:
> > Height Length
> > 93.0 25.375
> >
> > I want those values returned as feet. I'm seeing that I need to apply
*12
> to
> > a delcare statment, but not sure how to format the query.
> > I do not need to display the inches, just round the total footage up.
> >
> > any help is appreciated.
> >
> >
>

Monday, March 12, 2012

MDX year,month function

Is there a equivalent function from mdx to convert date to year or month like datepart from sql? ytd for example seems only working on a specified date member. But I want something like :

WITH

MEMBER [Measures].[ParameterCaption] AS '[aaaa].[bbbb].CURRENTMEMBER.MEMBER_CAPTION'

MEMBER [Measures].[ParameterValue] AS '[aaaa].[bbbb].CURRENTMEMBER.UNIQUENAME'

MEMBER [Measures].[ParameterLevel] AS '[aaaa].[bbbb].CURRENTMEMBER.LEVEL.ORDINAL'

SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,

[aaaa].[bbbb].AllMembers ON ROWS

FROM [XXXX]

...

but return all available years with the dates in the cube.

Thanks.

Regards

Alu

What I did was to amend my datasource view on which my cube is based, for date with a month and year field.

Then I did not need to worry about this in the MDX.|||MDX supports VBA function VBA!DatePart, but it performs worse then other MDX functions.|||

Hi thanks for the reply. However I have a data source view time dimension table and the mdx query which i have provided does not come from it. rather it comes from just a field with normal dates.

Thanks.

Regards

Alu