Showing posts with label exists. Show all posts
Showing posts with label exists. Show all posts

Friday, March 23, 2012

Link Server

Hi,
I got "there is no security context that we could use to
verified sql server exists." How should I resolve it?
Thanks in advance!
KarenMake sure you have set up a login mapping if required on the security tab.
See sp_addlinkedsrvlogin and "Establishing Security for Linked Servers" in
BOL for more details
--
HTH
Jasper Smith (SQL Server MVP)
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Karen" <k.duan@.ieee.org> wrote in message
news:086b01c3506c$56832070$a001280a@.phx.gbl...
Hi,
I got "there is no security context that we could use to
verified sql server exists." How should I resolve it?
Thanks in advance!
Karen|||I got "Error 7303: Could not initialize data source object
of OLE db provider 'Microsoft jet OLEdb 4.0'".
The two servers are in different domains. One is Windows
NT 4.0 and SQL 7; the other is Windows 2000 and sql 2000.
Is there any knowing issue about this?
Thank!
Karen|||No question is stupid question; plus you don't have
resolution too.
Karen

Monday, March 12, 2012

Limiting SQL results

I have a query that simply needs to determine if data exists in a table for
a given key.
Initially I used COUNT:
Select COUNT(*) from TABLEWITHTONSODATA Where Key = 'X'
The table has about 500,000 of rows so this takes too long.
Then I used TOP to speed things up. But TOP causes a timeout if key X isn't
in the table.
Does anyone have any suggestions on how to simply determine if key X has
records without counting every record?
Does anyone have a clue why TOP goes into never-never land if the table has
a lot of rows?
ThanksTry
if exists (Select 1 from TABLEWITHTONSODATA Where Key = 'X')
begin
...
end
"A" <agarrettbNOSPAM@.hotmail.com> wrote in message
news:eF6nK$sqDHA.2592@.TK2MSFTNGP10.phx.gbl...
> I have a query that simply needs to determine if data exists in a table
for
> a given key.
> Initially I used COUNT:
> Select COUNT(*) from TABLEWITHTONSODATA Where Key = 'X'
> The table has about 500,000 of rows so this takes too long.
> Then I used TOP to speed things up. But TOP causes a timeout if key X
isn't
> in the table.
> Does anyone have any suggestions on how to simply determine if key X has
> records without counting every record?
> Does anyone have a clue why TOP goes into never-never land if the table
has
> a lot of rows?
> Thanks
>|||Use EXISTS:
...
EXISTS
(SELECT *
FROM tablewithtonsodata
WHERE key = 'X')
If it's still too slow then consider indexing the column "key".
--
David Portas
--
Please reply only to the newsgroup
--|||You could do...
IF EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
SELECT 1
Or I believe this would perform equally well:
SELECT 1 WHERE EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
COUNT(*) has to actually go and count all of the rows. TOP has to return
based on ordering of some sort. EXISTS just needs to find a single row that
matches.
I assume that Key is indexed?
"A" <agarrettbNOSPAM@.hotmail.com> wrote in message
news:eF6nK$sqDHA.2592@.TK2MSFTNGP10.phx.gbl...
> I have a query that simply needs to determine if data exists in a table
for
> a given key.
> Initially I used COUNT:
> Select COUNT(*) from TABLEWITHTONSODATA Where Key = 'X'
> The table has about 500,000 of rows so this takes too long.
> Then I used TOP to speed things up. But TOP causes a timeout if key X
isn't
> in the table.
> Does anyone have any suggestions on how to simply determine if key X has
> records without counting every record?
> Does anyone have a clue why TOP goes into never-never land if the table
has
> a lot of rows?
> Thanks
>|||All great suggestions...will try. I am still wondering if anyone else has
had problems with TOP in large tables.
"A" <agarrettbNOSPAM@.hotmail.com> wrote in message
news:eF6nK$sqDHA.2592@.TK2MSFTNGP10.phx.gbl...
> I have a query that simply needs to determine if data exists in a table
for
> a given key.
> Initially I used COUNT:
> Select COUNT(*) from TABLEWITHTONSODATA Where Key = 'X'
> The table has about 500,000 of rows so this takes too long.
> Then I used TOP to speed things up. But TOP causes a timeout if key X
isn't
> in the table.
> Does anyone have any suggestions on how to simply determine if key X has
> records without counting every record?
> Does anyone have a clue why TOP goes into never-never land if the table
has
> a lot of rows?
> Thanks
>|||In article <ueHi#GtqDHA.1632@.TK2MSFTNGP10.phx.gbl>, amachanic@.air-
worldwide.nospamallowed.com said...
> You could do...
> IF EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
> SELECT 1
> Or I believe this would perform equally well:
> SELECT 1 WHERE EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
> COUNT(*) has to actually go and count all of the rows. TOP has to return
> based on ordering of some sort. EXISTS just needs to find a single row that
> matches.
Top doesn't have to have an order. I would think you would want to go
with:
IF EXISTS (SELECT TOP 1 'X' FROM TableWithTonsOfData With (NoLock) Where
Key = 'X')
-- Do your thing
The NoLock should help depending on usage.|||"Brad" <me@.privacy.net> wrote in message
news:MPG.1a1f0ba92c81d36f98b995@.news...
> Top doesn't have to have an order. I would think you would want to go
> with:
An unordered TOP is meaningless. TOP 1 what?|||In article <OuROemvqDHA.3732@.tk2msftngp13.phx.gbl>, amachanic@.air-
worldwide.nospamallowed.com said...
> "Brad" <me@.privacy.net> wrote in message
> news:MPG.1a1f0ba92c81d36f98b995@.news...
> > Top doesn't have to have an order. I would think you would want to go
> > with:
> An unordered TOP is meaningless. TOP 1 what?
It doesn't matter in his case because he is just checking existence. Top
1 is perfect for that because it tells the server to find one record in
whatever order is easiest and then stop.
I use top 1 * or top 10 * all of the time to just get a sample record(s).|||Brad wrote:
> In article <ueHi#GtqDHA.1632@.TK2MSFTNGP10.phx.gbl>, amachanic@.air-
> worldwide.nospamallowed.com said...
> > You could do...
> >
> > IF EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
> > SELECT 1
> >
> > Or I believe this would perform equally well:
> >
> > SELECT 1 WHERE EXISTS (SELECT * FROM TABLEWITHTONSODATA Where Key = 'X')
> >
> > COUNT(*) has to actually go and count all of the rows. TOP has to return
> > based on ordering of some sort. EXISTS just needs to find a single row that
> > matches.
> Top doesn't have to have an order. I would think you would want to go
> with:
> IF EXISTS (SELECT TOP 1 'X' FROM TableWithTonsOfData With (NoLock) Where
> Key = 'X')
> -- Do your thing
> The NoLock should help depending on usage.
Using EXISTS(SELECT TOP 1) will not be faster than EXIST(SELECT *), but
equally fast. This is because both can be satisfied with exactly the
same algorithm.
For that reason I would suggest you use the ANSI-SQL standard, and avoid
the SQL-Server proprietary TOP keyword.
Gert-Jan

Wednesday, March 7, 2012

LIMITED PIE CHART LEGEND ?

Hi,
I have a problem with Reporting services pie chart legend which is
limited in character
Does it exists a solution to write more text on pie charts legend ?
Thx !Hi rebeupaname,
Depending upon what you're after, you could either:
1) drop a textbox onto the chart and position it near the legend to add
supplemental info, or
2) use an expression for the series label to change the text inside of
the legend
Does this help?
Matt A
Reporting Services Newsletter at www.reportarchitex.com
rebeuapaname@.hotmail.com wrote:
> Hi,
> I have a problem with Reporting services pie chart legend which is
> limited in character
> Does it exists a solution to write more text on pie charts legend ?
> Thx !|||Thank you vert much, i have resolved the problem
But another limitation of PIE CHARTS make me loose time :
I'am looking for a maner to GROUP little values of a graph in one
categorie called "OTHER". For example all value under 1% will be
grouped in the "OTHER" category
Do you understand what i want to say ?
Thx