Showing posts with label hii. Show all posts
Showing posts with label hii. Show all posts

Sunday, March 25, 2012

count function

hi

I have a question related to XQUERY in SQL Server . is SQL Server 2005 supports Count function.

i want to make a query in which i want to search for some keyword in all the nodes. If there is some match then count the number of times that word appeared in XML.

Can anybody give me some clue about how to make this query .

thanks in advance

Regards

Ambi

XQuery includes the count() function to count sets of nodes. Here is the documentation on this function containing an example:

http://msdn2.microsoft.com/en-us/library/ms189963.aspx

If you want to query over all the nodes in the query, then the "//" ("descendents") operator will allow you to apply a filter to each node, then you can pass that nodeset to the count() function. Here is the documentation on all the path steps including //

http://msdn2.microsoft.com/en-us/library/ms190451.aspx

sql

count function

hi

I have a question related to XQUERY in SQL Server . is SQL Server 2005 supports Count function.

i want to make a query in which i want to search for some keyword in all the nodes. If there is some match then count the number of times that word appeared in XML.

Can anybody give me some clue about how to make this query .

thanks in advance

Regards

Ambi

XQuery includes the count() function to count sets of nodes. Here is the documentation on this function containing an example:

http://msdn2.microsoft.com/en-us/library/ms189963.aspx

If you want to query over all the nodes in the query, then the "//" ("descendents") operator will allow you to apply a filter to each node, then you can pass that nodeset to the count() function. Here is the documentation on all the path steps including //

http://msdn2.microsoft.com/en-us/library/ms190451.aspx

Count Children

Hi

I have a time dimension, that has an hierarchy with three levels, Year, Half Year and Month.

Is it possible to count how many days there are in each level?

Regards

You should be able to do this using the "Existing" function to count the number of days using the attribute hierarchy for days. Here is an example using AdventureWorks:

WITH

MEMBER MEASURES.[Count of Days]

AS

{Existing [Date].[Date].[Date].Members}.Count

SELECT

{MEASURES.[Count of Days]} ONCOLUMNS,

Hierarchize(

{{[Date].[Calendar].[Calendar Year].Members},

{[Date].[Calendar].[Calendar Quarter].Members},

{[Date].[Calendar].[Month].Members}}) ONROWS

FROM

[Adventure Works]

HTH,

Steve

|||

Hi Guys

Working with the same hierarchy,

Is it possible to know the FirstChild and LastChild members in each level?

I'm trying to do this but I get an error #Error

WITH

MEMBER [Measures].[First Day]

AS

{[Tiempo].[Fecha].FirstChild}

select

[Measures].[First Day] ON COLUMNS

from [MyCube]

Regards

|||

If you return a "day" member, then you will have to create the member on your time hierarchy. Try the following:

MEMBER [Tiempo].[Fecha].[First Day]

AS

Head({Existing [Tiempo].[Fecha].DefaultMember.Children},1)(0)

MEMBER [Tiempo].[Fecha].[Last Day]

AS

Tail({Existing [Tiempo].[Fecha].DefaultMember.Children},1)(0)

HTH,

Steve

|||

Hi Steve, thanks for answer

Let me undenstand, Do I need to add the day level in my hierarchy?

Those new members aren't measures, they are Time dimension members. Aren't they?

Do you have an example about how to use it?

Regards

Count CHAR(11) in a string

Hi
I need to cound the number of CHAR(11) charactors in a string.
I am currently attempting to use: len(string) - len(replace(string,
CHAR(11), ''))
But it seems to return far too many
Any help would be much appreciated
Thanks
B> But it seems to return far too many
Can you give an example?
SELECT LEN('foo') - REPLACE(LEN('foo'), CHAR(11), '')
returns 0...|||select dbo.OCCURS2 (string, CHAR(11))
CREATE function OCCURS2 (@.cSearchExpression nvarchar(4000),
@.cExpressionSearched nvarchar(4000))
returns smallint
as
begin
return
case
when datalength(@.cSearchExpression) > 0
then ( datalength(@.cExpressionSearched)
- datalength(replace(cast(@.cExpressionSear
ched as
nvarchar(4000)) COLLATE Latin1_General_BIN,
cast(@.cSearchExpression
as nvarchar(4000)) COLLATE Latin1_General_BIN, '')))
/ datalength(@.cSearchExpression)
else 0
end
end
GO
For more information about string UDFs Transact-SQL please visit the
http://www.universalthread.com/wcon...e~2,54,33,27115
Please, download the file
http://www.universalthread.com/wcon...treme~2,2,27115
With the best regards,
Igor.
"Ben" wrote:

> Hi
> I need to cound the number of CHAR(11) charactors in a string.
> I am currently attempting to use: len(string) - len(replace(string,
> CHAR(11), ''))
> But it seems to return far too many
> Any help would be much appreciated
> Thanks
> B
>
>|||hi
just try this:
its same as ur implementation:
declare
@.ch varchar(10)
set @.ch = 'ABC' + char(11) + 'DEF'
select len(@.ch) - len (replace(@.ch,char(11),''))
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
---
"Ben" wrote:

> Hi
> I need to cound the number of CHAR(11) charactors in a string.
> I am currently attempting to use: len(string) - len(replace(string,
> CHAR(11), ''))
> But it seems to return far too many
> Any help would be much appreciated
> Thanks
> B
>
>|||Chandra,
Please correct me if I am wrong but your solution may only work for one
occurrence of char(11).
I tried the following and still got 1 instead of 2.
declare
@.ch varchar(10)
set @.ch = 'ABC' + char(11) + 'DEF'+'jhi'+char(11)+'klm'
select len(@.ch) - len (replace(@.ch,char(11),''))
http://zulfiqar.typepad.com
BSEE, MCP
"Chandra" wrote:
> hi
> just try this:
> its same as ur implementation:
> declare
> @.ch varchar(10)
> set @.ch = 'ABC' + char(11) + 'DEF'
> select len(@.ch) - len (replace(@.ch,char(11),''))
>
> --
> best Regards,
> Chandra
> http://chanduas.blogspot.com/
> http://www.SQLResource.com/
> ---
>
> "Ben" wrote:
>|||Zulfiqar,
You've declared @.ch so that it can only hold 10 characters.
So the value you assigned to @.ch is truncated to
'ABC'+ CHAR(11) + 'DEFjh'
and this does in fact have only one char(11) value.
If you change the varchar(10) declaration to varchar(20) or larger,
you will get the result 2.
Steve Kass
Drew University
ZULFIQAR SYED wrote:

>Chandra,
>Please correct me if I am wrong but your solution may only work for one
>occurrence of char(11).
>I tried the following and still got 1 instead of 2.
>declare
>@.ch varchar(10)
>set @.ch = 'ABC' + char(11) + 'DEF'+'jhi'+char(11)+'klm'
>select len(@.ch) - len (replace(@.ch,char(11),''))
>
>|||Try:
declare
@.ch varchar(20)
set @.ch = 'ABC' + char(11) + 'DEF'+'jhi'+char(11)+'klm'
select '*' + @.ch + '*', len(@.ch), len (replace(@.ch,char(11),''))
Since @.ch was varchar(10):
ABCEFjhi
123456790
The char(11) fell off of the end.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"ZULFIQAR SYED" <DRSQLnospam2005@.hotmail.com> wrote in message
news:C0F8C537-9633-4880-831F-1497766F6870@.microsoft.com...
> Chandra,
> Please correct me if I am wrong but your solution may only work for one
> occurrence of char(11).
> I tried the following and still got 1 instead of 2.
> declare
> @.ch varchar(10)
> set @.ch = 'ABC' + char(11) + 'DEF'+'jhi'+char(11)+'klm'
> select len(@.ch) - len (replace(@.ch,char(11),''))
> --
> http://zulfiqar.typepad.com
> BSEE, MCP
>
> "Chandra" wrote:
>|||Sounds like another case for repeating the "string or binary data would be
truncated" error on invalid variable assignments. I wonder how often this
happens in the real world and people have no idea they're losing data.
"Steve Kass" <skass@.drew.edu> wrote in message
news:u$k1WGfqFHA.2064@.TK2MSFTNGP09.phx.gbl...
> Zulfiqar,
> You've declared @.ch so that it can only hold 10 characters.
> So the value you assigned to @.ch is truncated to
> 'ABC'+ CHAR(11) + 'DEFjh'
> and this does in fact have only one char(11) value.
> If you change the varchar(10) declaration to varchar(20) or larger,
> you will get the result 2.
> Steve Kass
> Drew University
> ZULFIQAR SYED wrote:
>|||Thank you everyone
Igor2004's solution worked perfectly.
Thanks again
B
"Igor2004" <Igor2004@.discussions.microsoft.com> wrote in message
news:D82A4BEE-4EC9-44DF-BD41-1A0E3D061EC3@.microsoft.com...
> select dbo.OCCURS2 (string, CHAR(11))
> CREATE function OCCURS2 (@.cSearchExpression nvarchar(4000),
> @.cExpressionSearched nvarchar(4000))
> returns smallint
> as
> begin
> return
> case
> when datalength(@.cSearchExpression) > 0
> then ( datalength(@.cExpressionSearched)
> - datalength(replace(cast(@.cExpressionSear
ched as
> nvarchar(4000)) COLLATE Latin1_General_BIN,
> cast(@.cSearchExpression
> as nvarchar(4000)) COLLATE Latin1_General_BIN, '')))
> / datalength(@.cSearchExpression)
> else 0
> end
> end
> GO
> For more information about string UDFs Transact-SQL please visit the
> http://www.universalthread.com/wcon...e~2,54,33,27115
> Please, download the file
> http://www.universalthread.com/wcon...treme~2,2,27115
> With the best regards,
> Igor.
>
> "Ben" wrote:
>

Monday, March 19, 2012

Could not locate entry in sysdatabases for database 'MYSQL

Hi
I am trying to run a stored procedure on a linked MySQL server
i can select from the MySQL server, so i know that there is a valid
link
i can run the stored procedure on the MySQL server using the command
call triodent.UpdateDownloadTable
but when i try to execute
exec MYSQL.triodent.UpdateDownloadTable
i get the "could not locate..." error
is it because MySQL is using call rather than exec? if so doesn't
anyone have an idea for the syntax?
many Thanks
Ian
Try
exec MYSQL.triodent..UpdateDownloadTable
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
<ian.tiesdell@.hotmail.co.uk> wrote in message
news:9f6c966a-b884-4efe-b037-2b339fb5d236@.q1g2000prf.googlegroups.com...
> Hi
> I am trying to run a stored procedure on a linked MySQL server
> i can select from the MySQL server, so i know that there is a valid
> link
> i can run the stored procedure on the MySQL server using the command
> call triodent.UpdateDownloadTable
> but when i try to execute
> exec MYSQL.triodent.UpdateDownloadTable
> i get the "could not locate..." error
> is it because MySQL is using call rather than exec? if so doesn't
> anyone have an idea for the syntax?
> many Thanks
> Ian
|||thanks jason but i get
Msg 7212, Level 17, State 1, Line 3
Could not execute procedure 'UpdateDownloadTable' on remote server
'MYSQL'.
:-(
|||That's progress. It sounds like it is permissions now. Verify the linked
server user has the rights to execute on MySQL.
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
<ian.tiesdell@.hotmail.co.uk> wrote in message
news:f098afcc-03ba-4977-9698-f38b83f34499@.b9g2000prh.googlegroups.com...
> thanks jason but i get
> Msg 7212, Level 17, State 1, Line 3
> Could not execute procedure 'UpdateDownloadTable' on remote server
> 'MYSQL'.
> :-(
|||jason wrote:
> That's progress. It sounds like it is permissions now. Verify the linked
> server user has the rights to execute on MySQL.
>
Also check the properties for the linked server and verify RPC is turned on.
|||sorry to be dim but how do i check this?
i've looked at server objects/linked servers security settings and i
have
connections will be made using this security context
remote login root
with password and then the password
RPC is turned on
Data Access is True
Ian
|||ian.tiesdell@.hotmail.co.uk wrote:
> sorry to be dim but how do i check this?
> i've looked at server objects/linked servers security settings and i
> have
> connections will be made using this security context
> remote login root
> with password and then the password
> RPC is turned on
> Data Access is True
> Ian
Well, if you looked at the linked server properties and saw the RPC is
enabled (there are two options), then that is all you need to do.
Jeff
|||so if the security settings are Ok and the syntax is OK?
what else could be wrong?
using
exec MYSQL.triodent..UpdateDownloadTable
Msg 7212, Level 17, State 1, Line 1
Could not execute procedure 'UpdateDownloadTable' on remote server
'MYSQL'
|||ian.tiesdell@.hotmail.co.uk wrote:
> so if the security settings are Ok and the syntax is OK?
> what else could be wrong?
> using
> exec MYSQL.triodent..UpdateDownloadTable
> Msg 7212, Level 17, State 1, Line 1
> Could not execute procedure 'UpdateDownloadTable' on remote server
> 'MYSQL'
Only thing I can think of is maybe permission issues in 'MYSQL'? I
don't know 'MYSQL' - so I really can't help with that side.
|||I think it could be mySQL causing the problem - what i've done is to
mimic the actions of the stored proc using update statements from
MSSQL over to the linked server
thanks for your input
Ian

Thursday, March 8, 2012

Could not find stored procedure ''?

Hi
I recently recovered my SQL2000 Sp3 Merge Replication structure from a
failure after adding a few new articles to my publication. Everything was
going fine (getting everyone up again), until I noticed 5 out of the 100
sites with the following problem:
The merge process could not retrieve column information for table
'dbo.C_ClaimStatus'.
(Source: Merge Replication Provider (Agent); Error number: -2147201016)
Could not find stored procedure ''.
(Source: DAYMED\CC (Data source); Error number: 2812)
I tried re-initialising these subcriptions again, but the problem stayed.
What bugs me is that all my sites were restarted in exactly the same way
(re-initialise site with a pre and post snapshot script to run) and these
are the only 5 sites with this problem.
(All sites are running MSDE sp3 or SQL2000 sp3 and are pull subscriptions)
Has anybody had this before, and if so, how do I fix this?
Regards
Paul Kleynhans
Paul,
This may be due to a failed sp installation. Reapplying sp3a may fix it and
to get a bit more info, have a look at sqlsp.log file from the c:\windows
directory - this might shed some light on any failed actions during the sp
installation.
Regards,
Paul Ibison

Wednesday, March 7, 2012

Could not find installable ISAM

Hi:

I got an error message when I am trying to have a stored procedure import a table from an excel file. It's a SQL Server 2005 and I have enable the Ad Hoc Distributed Queries option. The query I am testing is as below:

SELECT * FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=S:\myfile.xls;Extended Properties=Excel 11')...TEST$

The error message:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Could not find installable ISAM.".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

What could be the problem? Thanks.Hello

I have encountered the same problem while accesing from VB and access, I don't know how with SQL! Still what I did in my case is to run set up of Visual Studio and install the component in section Data Access - Jet IISAM. Try and see if this is of any help to you

Regards
Reshmi