Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

Thursday, March 22, 2012

Analysis function

I want to use Linear Regression functions -- example :LinRegSlope -- .in my
calculations.
Found that it's part of Analysis services.
Is there anyway I can get these fuctions in Standard edition of SQL
Server2000.
If not how can I achevice this .My application connect to SQL Server 2000
Standard edition.
ThanksAbraham,
I have a few examples of using SQL to calculate statistical information at
http://www.users.drew.edu/skass/sql/
The least squares fit example will get your linear regression slope.
SK
"Abraham" <binu_ca@.yahoo.com> wrote in message
news:ukKwkPp4DHA.1428@.TK2MSFTNGP12.phx.gbl...
> I want to use Linear Regression functions -- example :LinRegSlope -- .in
my
> calculations.
> Found that it's part of Analysis services.
> Is there anyway I can get these fuctions in Standard edition of SQL
> Server2000.
> If not how can I achevice this .My application connect to SQL Server 2000
> Standard edition.
> Thanks
>

Analysis function

I want to use Linear Regression functions -- example :LinRegSlope -- .in my
calculations.
Found that it's part of Analysis services.
Is there anyway I can get these fuctions in Standard edition of SQL
Server2000.
If not how can I achevice this .My application connect to SQL Server 2000
Standard edition.
ThanksAbraham,
I have a few examples of using SQL to calculate statistical information at
http://www.users.drew.edu/skass/sql/
The least squares fit example will get your linear regression slope.
SK
"Abraham" <binu_ca@.yahoo.com> wrote in message
news:ukKwkPp4DHA.1428@.TK2MSFTNGP12.phx.gbl...
quote:

> I want to use Linear Regression functions -- example :LinRegSlope -- .in

my
quote:

> calculations.
> Found that it's part of Analysis services.
> Is there anyway I can get these fuctions in Standard edition of SQL
> Server2000.
> If not how can I achevice this .My application connect to SQL Server 2000
> Standard edition.
> Thanks
>

Monday, March 19, 2012

An incorrect or unsupported HTTP function call was made error

Hi All,

I've got this error "An incorrect or unsupported HTTP function call was made"

I can't browse SQL CE Agent using IE also.

How to solve this error? TQ

You need to give more information for other people to help, for example, what device, OS, what IDE, what kind of program you are writing, where do you get the error, and how?


Lao K
Visit my Blog for Windows Mobile Pocket PC Smartphone Programming Hints and Tips

|||

OIC.. SORRY!!!

I'm developing Pocket PC Application. Then doing merge replication. When I want to run my app from PC through my PDA, I've got An incorrect or unsupported HTTP function call was made error. All I know this is IIS problem because I can't browse SQL Server CE Agent from PC/Pocket PC internet explorer.

I'm using :-

- VSNet 2003

- SQL Server CE

- SQL Server 2000

- HP iPAQ

- Windows Mobile 2003 Version 4.21.1088

- .Net Compact Framework 1.0

- ActiveSync 3.8

Thank you..

|||

When such error is thrown to app, the exception would contain the following:

Major Error number, Minor error number, HRESULT ... etc..

Can you please let us know the exception contents.

Sometimes you get error collection, check if you have got an error or a collection.

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Everywhere, Microsoft Corporation

|||

Sorry 4 the late respond..

I can't remember what the exception contain.. :D because now I'm using another computer..

My replication was successfully..

But when I want to change table design I've to delete the Publications, change table design then doing the new Publication again..

N then I've got this error :-

"Initializing SQL Server Reconciler has failed [,,,,,]"

"The Subscription to Publication 'PDA' is invalid"

What's wrong with my replication?

|||

1) Make sure that http://IISBoxName/VirtualDirName/sqlcesa30.dll?diag show GREEN SUCCESS for SQL Server Reconciler either 9.0 or 8.0 depending on your environment and SQL Server version.

2) Check whether replrec.dll, msgprox.dll, replerrx.dll are registered in %ProgramFiles%\Microsoft SQL Server\90\COM

Thanks

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Everywhere, Microsoft Corporation

|||

thanks Laxmi..

but I didn't understand the 1st step that u mention..

Can u tell me more bout that.. TQ

|||

if you made a change to the schema of the publication (published articles), you need to re-generate your snapshot. From within SQL Server 2005 Management Studio, right click on the publication itself and choose View Snapshot Agent Status. Then click the Start button in the resulting dialog.

Once the snapshot succeeds, re-try your replication.

Darren

|||thanks Darren.. but i'm using SQL Server 2000|||

regardless, you should generate a new snapshot of your publication.

Darren

|||

thankss Darren,

I tried so many time to generate new snapshot but I still got that 2 error. Finally, I've re-install my SQL Server 2000, SQL Server SP3a and SQL Server CE Tools.. n my replication success..

:D

Saturday, February 25, 2012

An aggregate function for most/last frequent?

Is there any function to do something like:
SELECT MOSTFREQUENT(MyCol) FROM MyTable
so that if MyCol had the vals:
'A'
'A'
'B'
'A'
'C'
'C'
'B'
'A'
the result would be 'A'
as opposed to having to do something (roughly) like:
SELECT MyCol FROM MyTable WHERE MyCol =
(SELECT MyCol FROM (
SELECT TOP 1 MyCol, COUNT(1) FROM MyTable ORDER BY COUNT(1) DESC
))In t-SQL, try:
SELECT TOP 1 col
FROM tbl
GROUP BY col
ORDER BY COUNT( col ) DESC ;
Anith|||Try,
select top 1 with ties mycol
from mytable
group by mycolumn
order by count(*) desc
AMB
"Arthur Dent" wrote:

> Is there any function to do something like:
> SELECT MOSTFREQUENT(MyCol) FROM MyTable
> so that if MyCol had the vals:
> 'A'
> 'A'
> 'B'
> 'A'
> 'C'
> 'C'
> 'B'
> 'A'
> the result would be 'A'
> as opposed to having to do something (roughly) like:
> SELECT MyCol FROM MyTable WHERE MyCol =
> (SELECT MyCol FROM (
> SELECT TOP 1 MyCol, COUNT(1) FROM MyTable ORDER BY COUNT(1) DESC
> ))
>
>|||That couldn't really be a SQL aggregate function because it's a set rather
than a scalar value - there could be more than one value of equal frequency.
David Portas
SQL Server MVP
--|||That works, and is pretty clean enough...
Thanks!
"Anith Sen" <anith@.bizdatasolutions.com> wrote in message
news:uoUQFAenFHA.3312@.tk2msftngp13.phx.gbl...
> In t-SQL, try:
> SELECT TOP 1 col
> FROM tbl
> GROUP BY col
> ORDER BY COUNT( col ) DESC ;
> --
> Anith
>|||Here is a version with the new CTE syntax:
WITH Histogram (mycol, tally)
AS (SELECT mycol, COUNT(*)
FROM Foobar
GROUP BY mycol)
SELECT mycol
FROM Histogram
WHERE tally = (SELECT MAX(tally) FROM Histogram);|||Very good point... i hadnt thought of that.
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:b_adnZ2dnZ1yEcKgnZ2dnQzGZ9-dnZ2dRVn-yZ2dnZ0@.giganews.com...
> That couldn't really be a SQL aggregate function because it's a set rather
> than a scalar value - there could be more than one value of equal
> frequency.
> --
> David Portas
> SQL Server MVP
> --
>|||Watch out for the solutions based on the TOP modifier because the results
may be non-deterministic. Unless you use the WITH TIES option or specify a
sort order that is unique you will just get some unpredictable "top" value
returned when there are duplicate values.
David Portas
SQL Server MVP
--

AMO: Role Member not existing in Active Directory

Hi,

I have a function in VB.Net that checks if role member is existing in Role. It's doing well, however, if role member is not existing in Active Directory it would prompt me this error during role update:

No mapping between account names and security IDs was done.

So, i provided an on error-resume-next error handler just for it to ignore the error. However, in the succeeding loops, eventhough the role member is existing in AD and not existing in Role, it's prompting me the same error each time it does a Role Update.

Was the error cached the first time? How do I manage this situation well?

cherriesh

Are you saying the user account did exist in AD, was added to your SSAS role, and then removed from AD which gives you the initial error? If so, was the user account disabled in AD or dropped from AD?

B.

|||

Hi,

the domain name is maintained in a specific table in the database which the user had keyed in. I access this table to add the domain name in my SSAS role. However, if the domain name is not really a real one or was entered with typo error, the SSAS will prompt an error at Role1.Update() command since the account entered has no match in AD. If i resume-next on this error, in the succeeding role update, it will prompt me the same error.

cherrie

|||

One of my guys ran into a similar issue on an AMO script. Here is the code he used in the script to resolve the problem:

Code Snippet

Try
currentRole.Members.Add(New RoleMember(RTrim(LTrim(dr(1).ToString))))
currentRole.Update()
Catch ex As Exception
currentRole.Refresh()
End Try

Hope that helps,

B.

Thursday, February 9, 2012

Alternative of Multistatement table-valued function in oracle

Hi all,
Can anybody tell me what is the equivalent of Multistatement table-valued function<UDF> in Oracle. I want to make a function which can return a table.
Thanks
AlokOriginally posted by Alokg
Hi all,
Can anybody tell me what is the equivalent of Multistatement table-valued function<UDF> in Oracle. I want to make a function which can return a table.

Thanks
Alok

You're in a different dimension now...

No table or cursor pointers...

but here's some sample code theft...

Create Function dbo.GetCSVTable
(
@.Array varchar(8000),
@.Delimiter varchar(8000) = ','
)
Returns @.table Table (
IndexID int Identity Not Null,
Value varchar(8000),
ValueInt int,
ValueDateTime datetime
)|||I want to write an UDF in ORACLE which can return a table. IN MSSQL we can use Multistatement table-valued functions but do we have some equivalent in ORACLE..
Can someone help me?

Thanks
Alok|||i think they call it "parameterized view" (it's been a while :)|||I see...got it backwards...

This is a sql server board though...

Oracle, unlike sql server doesn't move stuff around they supply pointers..

You should google "reference cursors" or go to tech net (or how about the right forum)

But here's a procedure that uses a ref cursor...I would imagine a function might make use of this way as well

PROCEDURE Get_EligPlanTypes_sp (I_EMPLID IN VARCHAR2,
EligPlanTypesCur OUT CurRefType) IS

BEGIN

--* Retrieve eligible plan types for entry into the plan object.

OPEN EligPlanTypesCur FOR SELECT DISPLAY_PLN_SEQ
,PLAN_TYPE
,OPTION_CD
,ELECTION_MADE
FROM ENR_PARTIC_PLAN
WHERE EMPLID = I_EMPLID
ORDER BY DISPLAY_PLN_SEQ;

EXCEPTION
WHEN OTHERS THEN
RAISE;

END Get_EligPlanTypes_sp;|||Here's a sample function..

CREATE OR REPLACE PACKAGE dba_Functions_Package
AS

Function InstrCount (strValue Varchar2
,strTarget Varchar2)
RETURN NUMBER;

END dba_Functions_Package;

/

CREATE OR REPLACE PACKAGE BODY dba_Functions_Package
AS
-- ************************************************** *******************
-- *** F U N C T I O N (InstrCount) D E C L A R A T I O N S *****
-- ************************************************** *******************

Function InstrCount (strValue IN Varchar2
,strTarget IN Varchar2)
RETURN Number
IS
numOccurs Integer := 0;
numReturn Number := -1;
BEGIN

While numReturn != 0 Loop
numReturn := Instr(strValue,strTarget,1,numOccurs+1);
If numReturn <> 0 Then
numOccurs := numOccurs + 1;
End If;
End Loop While;

RETURN(numOccurs);

EXCEPTION
WHEN OTHERS THEN RAISE;

End InstrCount;

END dba_Functions_Package;

/

alternative function for to_char in sql server

Hi,
Is there any alternative function for to_char in sql server 2005(T-SQL) that
converts numeric to character in the specified format?
to_char(5,'09')
will result in 05 (in oracle)
to_char(10,'09')
will result in 10 (in oracle)
ThanksJP
No, there isn't
DECLARE @.c AS INT
SET @.c=9
SELECT CASE WHEN LEN(@.c)=1 THEN '0'+ CAST(@.c AS VARCHAR(2))
ELSE CAST(@.c AS VARCHAR(2)) END
"JP" <JP@.discussions.microsoft.com> wrote in message
news:83C4046F-70C8-463B-B533-3D3C181D96DA@.microsoft.com...
> Hi,
> Is there any alternative function for to_char in sql server 2005(T-SQL)
> that
> converts numeric to character in the specified format?
> to_char(5,'09')
> will result in 05 (in oracle)
> to_char(10,'09')
> will result in 10 (in oracle)
> Thanks
>|||You dn't have a direct function.
Maybe you can use something like this
declare @.a int ,@.no_of_digits int
set @.a = 10 -- value
set @.no_of_digits = 2 -- No of digits you want to have in the final string
select right(replicate('0',@.no_of_digits) + cast(@.a as
varchar(30)),@.no_of_digits)
Hope this helps.
--
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/

alternative for last()

Hi,
Does somebody knows an alternative for the function last() in access. I've a
lot queries which uses last, but there is no alternative in sql server.
I used min/max but that did not gave me the right results. I need to know
the last row in a 1-to-many table situation.
Is there something like a hidden rowid i can use?Jason
See MAX(),MIN() funtions in the BOL.
\
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:OXIlbqZGFHA.3648@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Does somebody knows an alternative for the function last() in access. I've
a
> lot queries which uses last, but there is no alternative in sql server.
> I used min/max but that did not gave me the right results. I need to know
> the last row in a 1-to-many table situation.
> Is there something like a hidden rowid i can use?
>|||Select top 1 * from table order by field desc
Madhivanan|||There is NO exact equivalent of the LAST function of Access in SQL server.
This is based on the relational concept that the rows in a table are not
ordered.
So anything like LAST, FIRST, NEXT etc are totally meaningless.
If you have a column that records data in any chronological order, you can
achieve the same by using the MAX function.

> Is there something like a hidden rowid I can use?
No, there is nothing like that exposed.
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:OXIlbqZGFHA.3648@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Does somebody knows an alternative for the function last() in access. I've
> a
> lot queries which uses last, but there is no alternative in sql server.
> I used min/max but that did not gave me the right results. I need to know
> the last row in a 1-to-many table situation.
> Is there something like a hidden rowid i can use?
>|||HI Mad,
How is sytax if i want it to join with another table (the 1 side of
1-to-many)?
<madhivanan2001@.gmail.com> wrote in message
news:1109158964.898453.171390@.f14g2000cwb.googlegroups.com...
> Select top 1 * from table order by field desc
> Madhivanan
>|||If you have the concept of last, then there is some ordering.... If for
example you want the last price ( with the ordering being the title_id),
then sort the rows in the reverse order, so the last row becomes the first
row returned, and select the top 1... ie
select top 1 price from titles order by title_id desc
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:OXIlbqZGFHA.3648@.TK2MSFTNGP09.phx.gbl...
> Hi,
> Does somebody knows an alternative for the function last() in access. I've
> a
> lot queries which uses last, but there is no alternative in sql server.
> I used min/max but that did not gave me the right results. I need to know
> the last row in a 1-to-many table situation.
> Is there something like a hidden rowid i can use?
>|||Please post DDL and sample data so that we don't have to guess what
your table structure looks like:
http://www.aspfaq.com/etiquette.asp?id=5006
You'll aslo have to tell us what you mean by the "last row" there is no
fixed concept of first and last in a table because tables in SQL have
no inherent logical order.
David Portas
SQL Server MVP
--

alternative for crystal NEXT function

Hi,
Is there any alternative in SSRS 2000 for the NEXT function of Crystal. Or
can someone provide a code snippet or logic for the same.
--
Afaq ChoonawalaI am sorry, my Crystal knowledge is a little vague at this moment :-) Can
you tell us what this function does?
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:00748057-0DC5-4EE3-8C6D-A31EEEF1CA98@.microsoft.com...
> Hi,
> Is there any alternative in SSRS 2000 for the NEXT function of Crystal. Or
> can someone provide a code snippet or logic for the same.
> --
> Afaq Choonawala|||u can check the value any column in the next record while still being on the
current record
"Teo Lachev [MVP]" wrote:
> I am sorry, my Crystal knowledge is a little vague at this moment :-) Can
> you tell us what this function does?
> --
> HTH,
> ---
> Teo Lachev, MVP, MCSD, MCT
> "Microsoft Reporting Services in Action"
> "Applied Microsoft Analysis Services 2005"
> Home page and blog: http://www.prologika.com/
> ---
> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> news:00748057-0DC5-4EE3-8C6D-A31EEEF1CA98@.microsoft.com...
> > Hi,
> >
> > Is there any alternative in SSRS 2000 for the NEXT function of Crystal. Or
> > can someone provide a code snippet or logic for the same.
> > --
> > Afaq Choonawala
>
>|||There is no alternative for forward or random navigation. There is a
Previous function but it is an opposite of what you are trying to
accomplish. I hope a future release of RS would give us access to the
dataset before it is "bound" to the region, e.g. similar to binding ASP.NET
user controls. For the time being, consider bringing the the next record
value in the current record by transforming data at the data source.
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:408D700E-F282-467E-8B89-85D779958F4D@.microsoft.com...
>u can check the value any column in the next record while still being on
>the
> current record
>
> "Teo Lachev [MVP]" wrote:
>> I am sorry, my Crystal knowledge is a little vague at this moment :-) Can
>> you tell us what this function does?
>> --
>> HTH,
>> ---
>> Teo Lachev, MVP, MCSD, MCT
>> "Microsoft Reporting Services in Action"
>> "Applied Microsoft Analysis Services 2005"
>> Home page and blog: http://www.prologika.com/
>> ---
>> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
>> news:00748057-0DC5-4EE3-8C6D-A31EEEF1CA98@.microsoft.com...
>> > Hi,
>> >
>> > Is there any alternative in SSRS 2000 for the NEXT function of Crystal.
>> > Or
>> > can someone provide a code snippet or logic for the same.
>> > --
>> > Afaq Choonawala
>>|||Not sure if you will find this useful for your situation or not, but I am in
the process of converting our reports from Crystal Reports to SQL Server
Reporting Services and I came up with the following alternative for the NEXT
function in our situation.
Many of our reports consist of multiple groups with subtotals and grand
totals in the group footers. On some of the CR reports, we have a
conditional page break which forces a page break only if the NEXT group value
is equal to the current value. For example: {@.Bank_Name/Bank_HEADER} = Next
({@.Bank_Name/Bank_HEADER})
This prevents a group footer from appearing on a single page by itself.
My SSRS solution is to place all the group footer information in the
innermost group footer, but within their own individual table rows with the
innermost group footer's Page break at End property checked. Then I define
the table row's hidden property to an expression which evaluates the row
number of the group with the row count of the group, such as
=(RowNumber("table1_Group2")<>CountRows("table1_Group2")).
My Group 1 and Report Footers row hidden properties have the following
respective expressions:
=(RowNumber("table1_Group1")<>CountRows("table1_Group1"))
=(RowNumber("table1")<>CountRows("table1"))
As for the aggregate functions in each of the table rows, I apply the same
scope values to achieve the Group 2, Group 1, and report totals as in:
=Count(Fields!Formula_Acct_Num.Value, "table1_Group2")
=Count(Fields!Formula_Acct_Num.Value, "table1_Group1")
=Count(Fields!Formula_Acct_Num.Value, "table1")
= Sum(Fields!Formula_Balance.Value, "table1_Group2")
= Sum(Fields!Formula_Balance.Value, "table1_Group1")
= Sum(Fields!Formula_Balance.Value, "table1")
Enjoy!
"Teo Lachev [MVP]" wrote:
> There is no alternative for forward or random navigation. There is a
> Previous function but it is an opposite of what you are trying to
> accomplish. I hope a future release of RS would give us access to the
> dataset before it is "bound" to the region, e.g. similar to binding ASP.NET
> user controls. For the time being, consider bringing the the next record
> value in the current record by transforming data at the data source.
> --
> HTH,
> ---
> Teo Lachev, MVP, MCSD, MCT
> "Microsoft Reporting Services in Action"
> "Applied Microsoft Analysis Services 2005"
> Home page and blog: http://www.prologika.com/
> ---
> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> news:408D700E-F282-467E-8B89-85D779958F4D@.microsoft.com...
> >u can check the value any column in the next record while still being on
> >the
> > current record
> >
> >
> > "Teo Lachev [MVP]" wrote:
> >
> >> I am sorry, my Crystal knowledge is a little vague at this moment :-) Can
> >> you tell us what this function does?
> >>
> >> --
> >> HTH,
> >> ---
> >> Teo Lachev, MVP, MCSD, MCT
> >> "Microsoft Reporting Services in Action"
> >> "Applied Microsoft Analysis Services 2005"
> >> Home page and blog: http://www.prologika.com/
> >> ---
> >> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> >> news:00748057-0DC5-4EE3-8C6D-A31EEEF1CA98@.microsoft.com...
> >> > Hi,
> >> >
> >> > Is there any alternative in SSRS 2000 for the NEXT function of Crystal.
> >> > Or
> >> > can someone provide a code snippet or logic for the same.
> >> > --
> >> > Afaq Choonawala
> >>
> >>
> >>
>
>