Showing posts with label current. Show all posts
Showing posts with label current. Show all posts

Friday, March 30, 2012

Named set using LastPeriods (but not all of them)

To get the current period we have a named set Current Period. To get the last 13 periods we have a named set Last 13 Periods. We can aslo detect period that are not period 14.

Period 14 is an oddball period and I want to skip over it i.e Last 12 Periods will aways show data for the previuous 12 periods that were not periods 14s.

How do we link all of this to give the last 13 periods which were not a period 14?

Many thanks this is driving me bonkers.
Mark.

Code Snippet

CURRENT PERIOD
{
Filter([Alt Week Calendar].[Accounting Period].Members, [Alt Week Calendar].Currentmember.Properties("Period14")="1")
}

LAST 13 PERIODS
{LastPeriods
(13,Filter([Alt Week Calendar].[Accounting Period].Members,[Alt Week Calendar].Currentmember.Properties("Current Period")<>"0").Item(0))
}

NOT PERIOD 14
{
Filter([Alt Week Calendar].[Accounting Period].Members,[Accounting Week Calendar].Currentmember.Properties("Period14")<>"1")
}

Hi Mark,

Here's an example from Adventure Works which returns the last three days that aren't weekends:

Code Snippet

with member measures.demo as

generate(

tail(

exists(

[Date].[Date].currentmember.lag(5):[Date].[Date].currentmember

, [Date].[Day Name].&[2]:[Date].[Day Name].&[6])

,3)

, [Date].[Date].currentmember.name + " (" + [Date].[Date].currentmember.properties("Day Name") + ")", ", ")

select measures.demo on 0,

[Date].[Date].[Date].members on 1

from [Adventure Works]

What I'm doing here is finding the last five days, using an exists to get only the days from that set which are weekdays, then finding the last three days in the resulting set. The outermost Generate() is simply there to display the results of the expression in an easy-to-read way.

HTH,

Chris

named pipes vs tcp

Using SS2000 SP4. We have both named pipes (it's listed first) and TCP/IP
enable in network libraries. I noticed in EM under current activity and
process info for some processes named pipes is used and for other processes
something called LPC is used. Is LPC aka TCP/IP? It looks like when the
"host" for the process is the server, then it uses LPC but when the "host" i
s
a workstation it uses named pipes. Does it use named pipes for the
workstations because it is listed first in the network libraries? Is named
pipes slower than using TCP/IP. Should I list TCP/IP first and named pipes
second or just remove named pipes?
Thanks,
--
Dan D.Hi Dan
"Dan D." wrote:

> Using SS2000 SP4. We have both named pipes (it's listed first) and TCP/IP
> enable in network libraries. I noticed in EM under current activity and
> process info for some processes named pipes is used and for other processe
s
> something called LPC is used. Is LPC aka TCP/IP? It looks like when the
> "host" for the process is the server, then it uses LPC but when the "host"
is
> a workstation it uses named pipes. Does it use named pipes for the
> workstations because it is listed first in the network libraries? Is named
> pipes slower than using TCP/IP. Should I list TCP/IP first and named pipes
> second or just remove named pipes?
> Thanks,
> --
> Dan D.
LPC is a shared memory connection, that is why the host is the server
itself. The protocol used will be order by they are listed on the client, if
you client had TCP as the first protocol to use and the server has TCP/IP
enabled then that would be used. TCP/IP was made the primary protocol in SP3
a
so you may want to check what versions you are using. To see the client
protocols installed use the Client Networking Utility (on the client) there
are buttons that will let you change the order, and to check the for server
protocols use the Server Networking Utility on the server.
As far as speed, I believe they can be about the same, but with names pipes
there are potential security issues as you are connecting directly through
the filesystem of the server.
As far as removing named pipes, it is your choice.
John|||I understand. Thanks.
--
Dan D.
"John Bell" wrote:

> Hi Dan
> "Dan D." wrote:
>
> LPC is a shared memory connection, that is why the host is the server
> itself. The protocol used will be order by they are listed on the client,
if
> you client had TCP as the first protocol to use and the server has TCP/IP
> enabled then that would be used. TCP/IP was made the primary protocol in S
P3a
> so you may want to check what versions you are using. To see the client
> protocols installed use the Client Networking Utility (on the client) ther
e
> are buttons that will let you change the order, and to check the for serve
r
> protocols use the Server Networking Utility on the server.
> As far as speed, I believe they can be about the same, but with names pipe
s
> there are potential security issues as you are connecting directly through
> the filesystem of the server.
> As far as removing named pipes, it is your choice.
> John|||"Dan D." wrote:

> I understand. Thanks.
> --
> Dan D.
That is one of us then! I didn't realise it read so badly!
John

named pipes vs tcp

Using SS2000 SP4. We have both named pipes (it's listed first) and TCP/IP
enable in network libraries. I noticed in EM under current activity and
process info for some processes named pipes is used and for other processes
something called LPC is used. Is LPC aka TCP/IP? It looks like when the
"host" for the process is the server, then it uses LPC but when the "host" is
a workstation it uses named pipes. Does it use named pipes for the
workstations because it is listed first in the network libraries? Is named
pipes slower than using TCP/IP. Should I list TCP/IP first and named pipes
second or just remove named pipes?
Thanks,
Dan D.
Hi Dan
"Dan D." wrote:

> Using SS2000 SP4. We have both named pipes (it's listed first) and TCP/IP
> enable in network libraries. I noticed in EM under current activity and
> process info for some processes named pipes is used and for other processes
> something called LPC is used. Is LPC aka TCP/IP? It looks like when the
> "host" for the process is the server, then it uses LPC but when the "host" is
> a workstation it uses named pipes. Does it use named pipes for the
> workstations because it is listed first in the network libraries? Is named
> pipes slower than using TCP/IP. Should I list TCP/IP first and named pipes
> second or just remove named pipes?
> Thanks,
> --
> Dan D.
LPC is a shared memory connection, that is why the host is the server
itself. The protocol used will be order by they are listed on the client, if
you client had TCP as the first protocol to use and the server has TCP/IP
enabled then that would be used. TCP/IP was made the primary protocol in SP3a
so you may want to check what versions you are using. To see the client
protocols installed use the Client Networking Utility (on the client) there
are buttons that will let you change the order, and to check the for server
protocols use the Server Networking Utility on the server.
As far as speed, I believe they can be about the same, but with names pipes
there are potential security issues as you are connecting directly through
the filesystem of the server.
As far as removing named pipes, it is your choice.
John
|||I understand. Thanks.
Dan D.
"John Bell" wrote:

> Hi Dan
> "Dan D." wrote:
>
> LPC is a shared memory connection, that is why the host is the server
> itself. The protocol used will be order by they are listed on the client, if
> you client had TCP as the first protocol to use and the server has TCP/IP
> enabled then that would be used. TCP/IP was made the primary protocol in SP3a
> so you may want to check what versions you are using. To see the client
> protocols installed use the Client Networking Utility (on the client) there
> are buttons that will let you change the order, and to check the for server
> protocols use the Server Networking Utility on the server.
> As far as speed, I believe they can be about the same, but with names pipes
> there are potential security issues as you are connecting directly through
> the filesystem of the server.
> As far as removing named pipes, it is your choice.
> John
|||"Dan D." wrote:

> I understand. Thanks.
> --
> Dan D.
That is one of us then! I didn't realise it read so badly!
John

named pipes vs tcp

Using SS2000 SP4. We have both named pipes (it's listed first) and TCP/IP
enable in network libraries. I noticed in EM under current activity and
process info for some processes named pipes is used and for other processes
something called LPC is used. Is LPC aka TCP/IP? It looks like when the
"host" for the process is the server, then it uses LPC but when the "host" is
a workstation it uses named pipes. Does it use named pipes for the
workstations because it is listed first in the network libraries? Is named
pipes slower than using TCP/IP. Should I list TCP/IP first and named pipes
second or just remove named pipes?
Thanks,
--
Dan D.Hi Dan
"Dan D." wrote:
> Using SS2000 SP4. We have both named pipes (it's listed first) and TCP/IP
> enable in network libraries. I noticed in EM under current activity and
> process info for some processes named pipes is used and for other processes
> something called LPC is used. Is LPC aka TCP/IP? It looks like when the
> "host" for the process is the server, then it uses LPC but when the "host" is
> a workstation it uses named pipes. Does it use named pipes for the
> workstations because it is listed first in the network libraries? Is named
> pipes slower than using TCP/IP. Should I list TCP/IP first and named pipes
> second or just remove named pipes?
> Thanks,
> --
> Dan D.
LPC is a shared memory connection, that is why the host is the server
itself. The protocol used will be order by they are listed on the client, if
you client had TCP as the first protocol to use and the server has TCP/IP
enabled then that would be used. TCP/IP was made the primary protocol in SP3a
so you may want to check what versions you are using. To see the client
protocols installed use the Client Networking Utility (on the client) there
are buttons that will let you change the order, and to check the for server
protocols use the Server Networking Utility on the server.
As far as speed, I believe they can be about the same, but with names pipes
there are potential security issues as you are connecting directly through
the filesystem of the server.
As far as removing named pipes, it is your choice.
John|||I understand. Thanks.
--
Dan D.
"John Bell" wrote:
> Hi Dan
> "Dan D." wrote:
> > Using SS2000 SP4. We have both named pipes (it's listed first) and TCP/IP
> > enable in network libraries. I noticed in EM under current activity and
> > process info for some processes named pipes is used and for other processes
> > something called LPC is used. Is LPC aka TCP/IP? It looks like when the
> > "host" for the process is the server, then it uses LPC but when the "host" is
> > a workstation it uses named pipes. Does it use named pipes for the
> > workstations because it is listed first in the network libraries? Is named
> > pipes slower than using TCP/IP. Should I list TCP/IP first and named pipes
> > second or just remove named pipes?
> >
> > Thanks,
> > --
> > Dan D.
> LPC is a shared memory connection, that is why the host is the server
> itself. The protocol used will be order by they are listed on the client, if
> you client had TCP as the first protocol to use and the server has TCP/IP
> enabled then that would be used. TCP/IP was made the primary protocol in SP3a
> so you may want to check what versions you are using. To see the client
> protocols installed use the Client Networking Utility (on the client) there
> are buttons that will let you change the order, and to check the for server
> protocols use the Server Networking Utility on the server.
> As far as speed, I believe they can be about the same, but with names pipes
> there are potential security issues as you are connecting directly through
> the filesystem of the server.
> As far as removing named pipes, it is your choice.
> John|||"Dan D." wrote:
> I understand. Thanks.
> --
> Dan D.
That is one of us then! I didn't realise it read so badly!
Johnsql

Wednesday, March 21, 2012

Name of current db in proc

Hi,
What's the best way to get the name of the current db (not filename, but db
name) from inside a sp '
I'm writing a general sp that has to be put into numerous db's, except one
Kr.
SorenHi,
DB_NAME() must be the way to go :)
Soren
"Soeren S. Joergensen" <nospam@.nodomain.com> skrev i en meddelelse
news:eska3MgtFHA.2328@.TK2MSFTNGP10.phx.gbl...
> Hi,
> What's the best way to get the name of the current db (not filename, but
> db name) from inside a sp '
> I'm writing a general sp that has to be put into numerous db's, except one
>
> Kr.
> Soren
>sql

name of current database

I want to know the name of current database
for make something like that
DECLARE @.db_name varchar(100)
SET @.db_name = [the name of current database]
USE master
...
...
USE @.db_name
:Da quick search of BOL reveiled db_name().