Showing posts with label based. Show all posts
Showing posts with label based. Show all posts

Friday, March 30, 2012

OPENQUERY UPDATE Syntax help needed

Hi All

I am updating a local table based on inner join between local table
and remote table.

Update LocalTable
SET Field1 = B.Field1
FROM LinkedServer.dbname.dbo.RemoteTable B
INNER JOIN LocalTable A
ON B.Field2 = A.Field2
AND B.Field3 = A.Field3

This query takes 18 minutes to run.
I am hoping to speed up the process by writing in OPENQUERY syntax.

Thanks
RS(rshivaraman@.gmail.com) writes:

Quote:

Originally Posted by

I am updating a local table based on inner join between local table
and remote table.
>
Update LocalTable
SET Field1 = B.Field1
FROM LinkedServer.dbname.dbo.RemoteTable B
INNER JOIN LocalTable A
ON B.Field2 = A.Field2
AND B.Field3 = A.Field3
>
This query takes 18 minutes to run.
I am hoping to speed up the process by writing in OPENQUERY syntax.


UPDATE LocalTable
SET Field1 = B.Field1
FROM OPENQUERY(LINKEDSERVER,
'SELECT Field1, Field2, Field3 FROM dbname.dbo.RemoteTable) B
INNER JOIN LocalTable A
ON B.Field2 = A.Field2
AND B.Field3 = A.Field3

I would not really expect this to perform better.

Distributed queries are always difficult, but it's difficult to suggest
anything without further knowledge about the table. How big are the
two tables?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Monday, March 19, 2012

Open late close early

I'm porting a web based MS Access app (ASP) to MS SQL Server. With Access,
since it isn't multi-user, I always opened the database late and closed it
early in the code. Should I do the same thing with SQL Server or is it OK
to open/close the database at the HTTP session start/end? There will be
about 50 or so concurrent users. Thanks in advance.
It's still recommended that you "open late" / "close early" if you're using
any kind of pooled connection library. That way, connections will be able
to stay in the pool as long as possible.
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"Bob Smith" <noemail@.please.com> wrote in message
news:mCrkd.5370$z3.2192@.bignews5.bellsouth.net...
> I'm porting a web based MS Access app (ASP) to MS SQL Server. With
Access,
> since it isn't multi-user, I always opened the database late and closed it
> early in the code. Should I do the same thing with SQL Server or is it OK
> to open/close the database at the HTTP session start/end? There will be
> about 50 or so concurrent users. Thanks in advance.
>
|||"Bob Smith" <noemail@.please.com> wrote in message
news:mCrkd.5370$z3.2192@.bignews5.bellsouth.net...
> I'm porting a web based MS Access app (ASP) to MS SQL Server. With
Access,
> since it isn't multi-user, I always opened the database late and closed it
> early in the code. Should I do the same thing with SQL Server or is it OK
> to open/close the database at the HTTP session start/end? There will be
> about 50 or so concurrent users. Thanks in advance.
You don't really have the concept of "open" and "closing" a database in SQL
Server, but in general, you want to keep your actual work with the server
short and sweet. Keeping this attitude will help you avoid unnecessarily
prolonged transactions, blocking, etc.

>
|||Hi Bob,
Thanks for your post and thanks for Adam and Greg's
input.
"Open late, close early" is a good practice as this
frees resources while other logic is processing. I
suggest that you refer to this article for more
information:
258939 Recommendations for Connecting to Databases
Through Internet Information
http://support.microsoft.com/?id=258939
If you have any further questions or concerns please
feel free to let us know.
Sincerely,
William Wang
Microsoft Online Partner Support
Get Secure! - <www.microsoft.com/security>
================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and
confers no rights.
--
>From: "Bob Smith" <noemail@.please.com>
>Newsgroups: microsoft.public.sqlserver.server
>Subject: Open late close early
>Lines: 7
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <mCrkd.5370$z3.2192@.bignews5.bellsouth.net>
>X-Complaints-To: abuse@.bellsouth.net
>X-Abuse-Info: Please forward a copy of all headers for
proper handling
>X-Trace:
ldjgbllpbapjglppdbdpiflmbcekedmfhojhikkbagflhcbong abknppn
iiihliedillphahkfobdkeobjmjdcnmpcaoablghiflhmddnii fjhbmkd
mkllegdncmpbddgkbmehoimepnghmlnnpbhhjapgcojabh
>NNTP-Posting-Date: Wed, 10 Nov 2004 11:47:14 EST
>Organization: BellSouth Internet Group
>Date: Wed, 10 Nov 2004 11:49:37 -0500
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado .fastwe
bnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glor b.com!b
igfeed.bellsouth.net!bignumber.bellsouth.net!news. bellsou
th.net!bignews5.bellsouth.net.POSTED!1ec21f86!not-for-mai
l
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.sqlserver.server:366921
>X-Tomcat-NG: microsoft.public.sqlserver.server
>I'm porting a web based MS Access app (ASP) to MS SQL
Server. With Access,
>since it isn't multi-user, I always opened the database
late and closed it
>early in the code. Should I do the same thing with SQL
Server or is it OK
>to open/close the database at the HTTP session
start/end? There will be
>about 50 or so concurrent users. Thanks in advance.
>
>

Open late close early

I'm porting a web based MS Access app (ASP) to MS SQL Server. With Access,
since it isn't multi-user, I always opened the database late and closed it
early in the code. Should I do the same thing with SQL Server or is it OK
to open/close the database at the HTTP session start/end? There will be
about 50 or so concurrent users. Thanks in advance.It's still recommended that you "open late" / "close early" if you're using
any kind of pooled connection library. That way, connections will be able
to stay in the pool as long as possible.
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Bob Smith" <noemail@.please.com> wrote in message
news:mCrkd.5370$z3.2192@.bignews5.bellsouth.net...
> I'm porting a web based MS Access app (ASP) to MS SQL Server. With
Access,
> since it isn't multi-user, I always opened the database late and closed it
> early in the code. Should I do the same thing with SQL Server or is it OK
> to open/close the database at the HTTP session start/end? There will be
> about 50 or so concurrent users. Thanks in advance.
>|||"Bob Smith" <noemail@.please.com> wrote in message
news:mCrkd.5370$z3.2192@.bignews5.bellsouth.net...
> I'm porting a web based MS Access app (ASP) to MS SQL Server. With
Access,
> since it isn't multi-user, I always opened the database late and closed it
> early in the code. Should I do the same thing with SQL Server or is it OK
> to open/close the database at the HTTP session start/end? There will be
> about 50 or so concurrent users. Thanks in advance.
You don't really have the concept of "open" and "closing" a database in SQL
Server, but in general, you want to keep your actual work with the server
short and sweet. Keeping this attitude will help you avoid unnecessarily
prolonged transactions, blocking, etc.

>|||Hi Bob,
Thanks for your post and thanks for Adam and Greg's
input.
"Open late, close early" is a good practice as this
frees resources while other logic is processing. I
suggest that you refer to this article for more
information:
258939 Recommendations for Connecting to Databases
Through Internet Information
http://support.microsoft.com/?id=258939
If you have any further questions or concerns please
feel free to let us know.
Sincerely,
William Wang
Microsoft Online Partner Support
Get Secure! - <www.microsoft.com/security>
========================================
=============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and
confers no rights.
--
>From: "Bob Smith" <noemail@.please.com>
>Newsgroups: microsoft.public.sqlserver.server
>Subject: Open late close early
>Lines: 7
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <mCrkd.5370$z3.2192@.bignews5.bellsouth.net>
>X-Complaints-To: abuse@.bellsouth.net
>X-Abuse-Info: Please forward a copy of all headers for
proper handling
>X-Trace:
ldjgbllpbapjglppdbdpiflmbcekedmfhojhikkb
agflhcbongabknppn
iiihliedillphahkfobdkeobjmjdcnmpcaoablgh
iflhmddniifjhbmkd
mkllegdncmpbddgkbmehoimepnghmlnnpbhhjapg
cojabh
>NNTP-Posting-Date: Wed, 10 Nov 2004 11:47:14 EST
>Organization: BellSouth Internet Group
>Date: Wed, 10 Nov 2004 11:49:37 -0500
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fastwe
bnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glorb.com!b
igfeed.bellsouth.net!bignumber.bellsouth.net!news.bellsou
th.net!bignews5.bellsouth.net.POSTED!1ec21f86!not-for-mai
l
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.sqlserver.server:366921
>X-Tomcat-NG: microsoft.public.sqlserver.server
>I'm porting a web based MS Access app (ASP) to MS SQL
Server. With Access,
>since it isn't multi-user, I always opened the database
late and closed it
>early in the code. Should I do the same thing with SQL
Server or is it OK
>to open/close the database at the HTTP session
start/end? There will be
>about 50 or so concurrent users. Thanks in advance.
>
>

Open late close early

I'm porting a web based MS Access app (ASP) to MS SQL Server. With Access,
since it isn't multi-user, I always opened the database late and closed it
early in the code. Should I do the same thing with SQL Server or is it OK
to open/close the database at the HTTP session start/end? There will be
about 50 or so concurrent users. Thanks in advance.It's still recommended that you "open late" / "close early" if you're using
any kind of pooled connection library. That way, connections will be able
to stay in the pool as long as possible.
--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Bob Smith" <noemail@.please.com> wrote in message
news:mCrkd.5370$z3.2192@.bignews5.bellsouth.net...
> I'm porting a web based MS Access app (ASP) to MS SQL Server. With
Access,
> since it isn't multi-user, I always opened the database late and closed it
> early in the code. Should I do the same thing with SQL Server or is it OK
> to open/close the database at the HTTP session start/end? There will be
> about 50 or so concurrent users. Thanks in advance.
>|||"Bob Smith" <noemail@.please.com> wrote in message
news:mCrkd.5370$z3.2192@.bignews5.bellsouth.net...
> I'm porting a web based MS Access app (ASP) to MS SQL Server. With
Access,
> since it isn't multi-user, I always opened the database late and closed it
> early in the code. Should I do the same thing with SQL Server or is it OK
> to open/close the database at the HTTP session start/end? There will be
> about 50 or so concurrent users. Thanks in advance.
You don't really have the concept of "open" and "closing" a database in SQL
Server, but in general, you want to keep your actual work with the server
short and sweet. Keeping this attitude will help you avoid unnecessarily
prolonged transactions, blocking, etc.
>|||Hi Bob,
Thanks for your post and thanks for Adam and Greg's
input.
"Open late, close early" is a good practice as this
frees resources while other logic is processing. I
suggest that you refer to this article for more
information:
258939 Recommendations for Connecting to Databases
Through Internet Information
http://support.microsoft.com/?id=258939
If you have any further questions or concerns please
feel free to let us know.
Sincerely,
William Wang
Microsoft Online Partner Support
Get Secure! - <www.microsoft.com/security>
=====================================================When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and
confers no rights.
--
>From: "Bob Smith" <noemail@.please.com>
>Newsgroups: microsoft.public.sqlserver.server
>Subject: Open late close early
>Lines: 7
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <mCrkd.5370$z3.2192@.bignews5.bellsouth.net>
>X-Complaints-To: abuse@.bellsouth.net
>X-Abuse-Info: Please forward a copy of all headers for
proper handling
>X-Trace:
ldjgbllpbapjglppdbdpiflmbcekedmfhojhikkbagflhcbongabknppn
iiihliedillphahkfobdkeobjmjdcnmpcaoablghiflhmddniifjhbmkd
mkllegdncmpbddgkbmehoimepnghmlnnpbhhjapgcojabh
>NNTP-Posting-Date: Wed, 10 Nov 2004 11:47:14 EST
>Organization: BellSouth Internet Group
>Date: Wed, 10 Nov 2004 11:49:37 -0500
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fastwe
bnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glorb.com!b
igfeed.bellsouth.net!bignumber.bellsouth.net!news.bellsou
th.net!bignews5.bellsouth.net.POSTED!1ec21f86!not-for-mai
l
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.sqlserver.server:366921
>X-Tomcat-NG: microsoft.public.sqlserver.server
>I'm porting a web based MS Access app (ASP) to MS SQL
Server. With Access,
>since it isn't multi-user, I always opened the database
late and closed it
>early in the code. Should I do the same thing with SQL
Server or is it OK
>to open/close the database at the HTTP session
start/end? There will be
>about 50 or so concurrent users. Thanks in advance.
>
>

Wednesday, March 7, 2012

Only parameter values which have facts...

In a reporting services report based on a cube I have a parameter in which I
only want to show the values which have measures in a measuregroup asociated
with it.
For Example: I only want to choose products which have sales in the cube.
(retrieving the values outside the cube is not an option)
How can I achieve this'
Thanx
PieterChange the select for the product list to include a where clause for the
measure:
WHERE ([Measures].[Product Sales])
"Pieter M" <Pieter M@.discussions.microsoft.com> wrote in message
news:0CA17070-4932-445B-A8ED-AA529B48FAE7@.microsoft.com...
> In a reporting services report based on a cube I have a parameter in which
> I
> only want to show the values which have measures in a measuregroup
> asociated
> with it.
> For Example: I only want to choose products which have sales in the cube.
> (retrieving the values outside the cube is not an option)
> How can I achieve this'
> Thanx
> Pieter|||Thaks Tim,
but where do I have to put this? In SQL I would know where, but in MDX?
My quey looks like this:
WITH MEMBER [Measures].[ParameterCaption] AS '[Kalender].[Jaar Nummer
Lang].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS
'[Kalender].[Jaar Nummer Lang].CURRENTMEMBER.UNIQUENAME' MEMBER
[Measures].[ParameterLevel] AS '[Kalender].[Jaar Nummer
Lang].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption],
[Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,
[Kalender].[Jaar Nummer Lang].ALLMEMBERS ON ROWS FROM [Cube]
Thanks.
Pieter
"Tim Dot NoSpam" wrote:
> Change the select for the product list to include a where clause for the
> measure:
> WHERE ([Measures].[Product Sales])
> "Pieter M" <Pieter M@.discussions.microsoft.com> wrote in message
> news:0CA17070-4932-445B-A8ED-AA529B48FAE7@.microsoft.com...
> > In a reporting services report based on a cube I have a parameter in which
> > I
> > only want to show the values which have measures in a measuregroup
> > asociated
> > with it.
> > For Example: I only want to choose products which have sales in the cube.
> > (retrieving the values outside the cube is not an option)
> > How can I achieve this'
> >
> > Thanx
> >
> > Pieter
>
>|||HI,
When I change my query to this:
WITH MEMBER [Measures].[ParameterCaption] AS '[Kalender].[Jaar Nummer
Lang].CURRENTMEMBER.MEMBER_CAPTION' MEMBER [Measures].[ParameterValue] AS
'[Kalender].[Jaar Nummer Lang].CURRENTMEMBER.UNIQUENAME' MEMBER
[Measures].[ParameterLevel] AS '[Kalender].[Jaar Nummer
Lang].CURRENTMEMBER.LEVEL.ORDINAL' SELECT {[Measures].[ParameterCaption],
[Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,
[Kalender].[Jaar Nummer Lang].ALLMEMBERS ON ROWS FROM [Cube] WHERE
([Measures].[Product Sales])
I get the following error:
TITLE: Microsoft Visual Studio
--
Query preparation failed.
--
ADDITIONAL INFORMATION:
The Measures hierarchy already appears in the Axis0 axis. (Microsoft SQL
Server 2005 Analysis Services)
--
BUTTONS:
OK
--
Can anybody tell me what I am doing wrong and and maybe a suggestion how to
solve this
"Tim Dot NoSpam" wrote:
> Change the select for the product list to include a where clause for the
> measure:
> WHERE ([Measures].[Product Sales])
> "Pieter M" <Pieter M@.discussions.microsoft.com> wrote in message
> news:0CA17070-4932-445B-A8ED-AA529B48FAE7@.microsoft.com...
> > In a reporting services report based on a cube I have a parameter in which
> > I
> > only want to show the values which have measures in a measuregroup
> > asociated
> > with it.
> > For Example: I only want to choose products which have sales in the cube.
> > (retrieving the values outside the cube is not an option)
> > How can I achieve this'
> >
> > Thanx
> >
> > Pieter
>
>