Showing posts with label order. Show all posts
Showing posts with label order. Show all posts

Monday, March 26, 2012

Rights to access an external 2005 analysis server

Hi,

I just wanted to know what rights as a user one would need in order
to edit/process a cube which is on an external 2005 Analysis Server.
Right now my user is part of the SQLServer2005MSOLAPUser$Machine
Name$MSSQLSERVER group on this server.
I am able to connect to thsi server through SQL Server Management
Studio., but I dont see any analysis services databases under it.

Thanks

In AS 2005 you manage security through the database roles, not by OS security groups. This is change from AS2000. I am guessing you are current AS2000 user and trying apply the same logic.

To grant processing rights. Create a database role, add your user and grant the role youve created processing rights to the cube. This should be pretty straightforward.

Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

Wednesday, March 21, 2012

rewriting SQL to avoid multiple scan of a table

Hi,

Is it possible to rewrite the following statement in order to avoid multiple scan of the tables:

SELECT
(ACT.ID_ACCES_CLIENT_TYPE * 100000) + 30024 ss_key,
TO_CHAR(( SYSDATE ),'MM/DD/YYYY') date_key,
30024 transtype_key,
ACT.ID_ACCES_CLIENT_TYPE client_acces_d_sskey,
T.ID_MODELE fonct_mobile_d_sskey,
'0' type_mobile_key,
1 MEMBER
FROM ACCES_CLIENT_TYPE ACT, ACCES AC, TYPE_MODELE T
where ACT.FLAG_ACTIF is not null
and NVL(( ACT.DAT_FIN ),( SYSDATE ))> SYSDATE - ((3 + 0)*30)
and AC.ID_ACCES = ACT.ID_ACCES
and AC.FLAG_ACTIF is not null
and T.TAC = AC.TAC_1
AND mod(ACT.ID_ACCES_CLIENT_TYPE, 2) = 1
union all
SELECT
(ACT.ID_ACCES_CLIENT_TYPE * 100000) + 30025 ss_key,
TO_CHAR(( SYSDATE ),'MM/DD/YYYY') date_key,
30025 transtype_key,
ACT.ID_ACCES_CLIENT_TYPE client_acces_d_sskey,
T.ID_MODELE fonct_mobile_d_sskey,
'1' type_mobile_key,
1 MEMBER
FROM ACCES_CLIENT_TYPE ACT, ACCES AC, TYPE_MODELE T
where ACT.FLAG_ACTIF is not null
and NVL(( ACT.DAT_FIN ),( SYSDATE ))> SYSDATE - ((3 + 0)*30)
and AC.ID_ACCES = ACT.ID_ACCES
and AC.FLAG_ACTIF is not null
and T.TAC = AC.TAC_U
AND mod(ACT.ID_ACCES_CLIENT_TYPE, 2) = 1
union all
SELECT
(ACT.ID_ACCES_CLIENT_TYPE * 100000) + 30026 ss_key,
TO_CHAR(( SYSDATE ),'MM/DD/YYYY') date_key,
30026 transtype_key,
ACT.ID_ACCES_CLIENT_TYPE client_acces_d_sskey,
T.ID_MODELE fonct_mobile_d_sskey,
'2' type_mobile_key,
1 MEMBER
FROM ACCES_CLIENT_TYPE ACT, ACCES AC, TYPE_MODELE T
where ACT.FLAG_ACTIF is not null
and NVL(( ACT.DAT_FIN ),( SYSDATE ))> SYSDATE - ((3 + 0)*30)
and AC.ID_ACCES = ACT.ID_ACCES
and AC.FLAG_ACTIF is not null
and T.TAC = AC.TACG_G
AND mod(ACT.ID_ACCES_CLIENT_TYPE, 2) = 1

Thanks for helpAre you assuming that the table scan is not a the optimal access path that your DBMS (whatever it may be) will choose regardless of the number of rows and organization of the tables?|||The query is doing 3 table scan of acces_client_type but maybe this query can be rewrite without union all. But how can i vary in one query type_mobile_key and ss_key ?

Tuesday, March 20, 2012

Revert to checkpoint

Hi,
Our application has an automatic software update feature.
We want to create a checkpoint (certain point in time) in the database
in order to revert to this checkpoint when somewhere in the software
update sequence error(s) occur...
Is this possible in MSSQL?
Transaction blocks are not possible because queries are executed from
different parts of our code...
Thanks in advance,
Greetz,
R. Oosterholt
Hi
Your code sounds to be a nightmare especially as this is a software upgrade.
I suggest that you backup the database at given points so that you can
restore to a known point, or instigate a mechanism that you can log the times
when you can recover to a known point in time.
John
"r.oosterholt@.gmail.com" wrote:

> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
> Thanks in advance,
> Greetz,
> R. Oosterholt
>
|||r.oosterholt@.gmail.com wrote:
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
> Thanks in advance,
> Greetz,
> R. Oosterholt
>
If you're doing regular transaction log backups, you can restore a
database to any point in time using the STOPAT clause on the RESTORE
command...
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||<r.oosterholt@.gmail.com> wrote in message
news:1163779835.179635.247540@.b28g2000cwb.googlegr oups.com...
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
>
Can you just take a full database backup, and restore the backup on failure?
Also on Enterprise Edition, you can take a Database Snapshot, and restore
from that.
David
|||Thanks all!
Snapshot is the best option for us.
Pity it is only available in 2005 EE...
Rick O.
On 17 nov, 17:25, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> One option could be to set a log marker (BAGINF TRAN ... WITH MARK) so you later can restore to that
> point when you restore a transaction log backup. Assumes a sound backup strategy, of course.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://www.solidqualitylearning.com/
> <r.oosterh...@.gmail.com> wrote in messagenews:1163779835.179635.247540@.b28g2000cwb.g ooglegroups.com...
>
>
>
>

Revert to checkpoint

Hi,
Our application has an automatic software update feature.
We want to create a checkpoint (certain point in time) in the database
in order to revert to this checkpoint when somewhere in the software
update sequence error(s) occur...
Is this possible in MSSQL?
Transaction blocks are not possible because queries are executed from
different parts of our code...
Thanks in advance,
Greetz,
R. OosterholtHi
Your code sounds to be a nightmare especially as this is a software upgrade.
I suggest that you backup the database at given points so that you can
restore to a known point, or instigate a mechanism that you can log the times
when you can recover to a known point in time.
John
"r.oosterholt@.gmail.com" wrote:
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
> Thanks in advance,
> Greetz,
> R. Oosterholt
>|||r.oosterholt@.gmail.com wrote:
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
> Thanks in advance,
> Greetz,
> R. Oosterholt
>
If you're doing regular transaction log backups, you can restore a
database to any point in time using the STOPAT clause on the RESTORE
command...
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||<r.oosterholt@.gmail.com> wrote in message
news:1163779835.179635.247540@.b28g2000cwb.googlegroups.com...
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
>
Can you just take a full database backup, and restore the backup on failure?
Also on Enterprise Edition, you can take a Database Snapshot, and restore
from that.
David|||One option could be to set a log marker (BAGINF TRAN ... WITH MARK) so you later can restore to that
point when you restore a transaction log backup. Assumes a sound backup strategy, of course.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<r.oosterholt@.gmail.com> wrote in message
news:1163779835.179635.247540@.b28g2000cwb.googlegroups.com...
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
> Thanks in advance,
> Greetz,
> R. Oosterholt
>|||Thanks all!
Snapshot is the best option for us.
Pity it is only available in 2005 EE...
Rick O.
On 17 nov, 17:25, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> One option could be to set a log marker (BAGINF TRAN ... WITH MARK) so you later can restore to that
> point when you restore a transaction log backup. Assumes a sound backup strategy, of course.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://www.solidqualitylearning.com/
> <r.oosterh...@.gmail.com> wrote in messagenews:1163779835.179635.247540@.b28g2000cwb.googlegroups.com...
>
> > Hi,
> > Our application has an automatic software update feature.
> > We want to create a checkpoint (certain point in time) in the database
> > in order to revert to this checkpoint when somewhere in the software
> > update sequence error(s) occur...
> > Is this possible in MSSQL?
> > Transaction blocks are not possible because queries are executed from
> > different parts of our code...
> > Thanks in advance,
> > Greetz,
> > R. Oosterholt- Tekst uit oorspronkelijk bericht niet weergeven -- Tekst uit oorspronkelijk bericht weergeven -

Revert to checkpoint

Hi,
Our application has an automatic software update feature.
We want to create a checkpoint (certain point in time) in the database
in order to revert to this checkpoint when somewhere in the software
update sequence error(s) occur...
Is this possible in MSSQL?
Transaction blocks are not possible because queries are executed from
different parts of our code...
Thanks in advance,
Greetz,
R. OosterholtHi
Your code sounds to be a nightmare especially as this is a software upgrade.
I suggest that you backup the database at given points so that you can
restore to a known point, or instigate a mechanism that you can log the time
s
when you can recover to a known point in time.
John
"r.oosterholt@.gmail.com" wrote:

> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
> Thanks in advance,
> Greetz,
> R. Oosterholt
>|||One option could be to set a log marker (BAGINF TRAN ... WITH MARK) so you l
ater can restore to that
point when you restore a transaction log backup. Assumes a sound backup stra
tegy, of course.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<r.oosterholt@.gmail.com> wrote in message
news:1163779835.179635.247540@.b28g2000cwb.googlegroups.com...
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
> Thanks in advance,
> Greetz,
> R. Oosterholt
>|||r.oosterholt@.gmail.com wrote:
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
> Thanks in advance,
> Greetz,
> R. Oosterholt
>
If you're doing regular transaction log backups, you can restore a
database to any point in time using the STOPAT clause on the RESTORE
command...
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||<r.oosterholt@.gmail.com> wrote in message
news:1163779835.179635.247540@.b28g2000cwb.googlegroups.com...
> Hi,
> Our application has an automatic software update feature.
> We want to create a checkpoint (certain point in time) in the database
> in order to revert to this checkpoint when somewhere in the software
> update sequence error(s) occur...
> Is this possible in MSSQL?
> Transaction blocks are not possible because queries are executed from
> different parts of our code...
>
Can you just take a full database backup, and restore the backup on failure?
Also on Enterprise Edition, you can take a Database Snapshot, and restore
from that.
David|||Thanks all!
Snapshot is the best option for us.
Pity it is only available in 2005 EE...
Rick O.
On 17 nov, 17:25, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> One option could be to set a log marker (BAGINF TRAN ... WITH MARK) so you
later can restore to that
> point when you restore a transaction log backup. Assumes a sound backup st
rategy, of course.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://www.solidqualitylearning.com/
> <r.oosterh...@.gmail.com> wrote in messagenews:1163779835.179635.247540@.b28
g2000cwb.googlegroups.com...
>
>
>
>
>
>
>

Monday, March 12, 2012

reverse order of hex bytes

is there a function in sql server to select the REVERSE order of a 32bit hex
value?
then i also need to convert each byte to a decimal number.
any help is much appreciated..
tia,
jtCan you post an example of what you are trying to accomplish?
If I understood your question right, it is not too hard to write a simple
function to change the order of hexdigits. In SQL 2000, there is an
undocumented proc xp_varbintohexstr, which you can use in a procedural loop
& get this done as well.
Anith|||Take a look at this example:
http://milambda.blogspot.com/2005/0...a.blogspot.com/|||>> is there a function in SQL Sserver to select the REVERSE order of a 32-bi
t hex value? <<
Why are you doing low level bit manipulation in SQL? This is like
driving screws wirh a brick. What are you trying to do? What is your
data model? Surely it is NOT at that physical level!!|||The benefit of a database is not just for storage but its ability todo
efficient data manipulation.
You seem to be stuck in the 70's store and retreieve model, client/server
techniques have passed you by!
I have a client who uses SQL Server to store GBytes of technical data and
requires the ability to do conversion like this to produce taylor data
exports for his own clients; the question - does he program the export in a
3gl or more easily using T-SQL (what its designed for) and binary
manipulation on the SELECT statement?
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"--CELKO--" <jcelko212@.earthlink.net> wrote in message
news:1137469420.061461.205740@.g47g2000cwa.googlegroups.com...
> Why are you doing low level bit manipulation in SQL? This is like
> driving screws wirh a brick. What are you trying to do? What is your
> data model? Surely it is NOT at that physical level!!
>

Tuesday, February 21, 2012

returning limited number of records!

I am using ORDER BY NEWID() to return random record from sql database. how do i go about returning only 5 random records instead of all records.

Thanks.Since SELECT * FROM Table ORDER BY NEWID() will return the rows in a random order, all you need to do is use the TOP keyword to limit the results for that particular query.

SELECT TOP 5 * FROM Table
ORDER BY NEWID()

If, for some reason, that doesn't work, there's the slightly less elegant solution of

SET ROWCOUNT = 5
SELECT * FROM Table
ORDER BY NEWID()
SET ROWCOUNT = 0

I hope this helps.|||it's working perfect.

thanks.