Showing posts with label service. Show all posts
Showing posts with label service. Show all posts

Wednesday, March 21, 2012

how to include a sql database in a web service

i am using vs2005 and sql 2005 and i want to include a database in a webservice, how to do that? and where are the items in the toolbox?

Hi,

If you are looking to add a database to SqlExpress in a webservice application please have a look at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=276342&SiteID=1 posting which mentions that you can add a database by using "Add New Item...". Another way would be to go to the "Tools" menu and click on "Connect to database..." and follow the instructions to add a new database.

Please reply if this is not the scenario you are trying to achieve.

Jimmy

Monday, March 19, 2012

how to improve performance of LEFT JOIN

I am developing reporting service and using lots of 'LEFT OUTER JOIN',
I am worried about the performance and want to use some subquery to
improve
the performance.
Could I do that like below,

[the origin source]
SELECT *
FROM TableA
LEFT OUTER JOIN TableB
ON TableA.item1 = TableB.item1
WHERE TableA.item2 = 'xxxx'
TableB.item2 > yyyy AND TableB.item2 < zzzz

I add the subquery to query every table before 'LEFT JOIN'
-----------------------
SELECT *
FROM
(SELECT *
FROM TableA
WHERE TableA.item2 = 'xxxx'
) TableC
LEFT OUTER JOIN
(SELECT *
FROM TableB
WHERE TableB.item2 > yyyy AND TableB.item2 < zzzz
) TableD
ON TableC.item1 = TableD.item1
WHERE TableC.item2 = 'xxxx'
TableD.item2 > yyyy AND TableD.item2 < zzzz
-----------------------

Can anyone give me some suggestion?
Thanks a lot.

Leland HuangBe careful. Your LEFT JOIN is actually an INNER JOIN in disguise (as well
as having a syntax error). Try:

SELECT *
FROM TableA
LEFT OUTER JOIN TableB
ON TableA.item1 = TableB.item1
AND TableB.item2 > yyyy AND TableB.item2 < zzzz
WHERE TableA.item2 = 'xxxx'

--
Tom

----------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada

<lelandhuang@.gmail.com> wrote in message
news:1147934223.710966.324990@.j33g2000cwa.googlegr oups.com...
I am developing reporting service and using lots of 'LEFT OUTER JOIN',
I am worried about the performance and want to use some subquery to
improve
the performance.
Could I do that like below,

[the origin source]
SELECT *
FROM TableA
LEFT OUTER JOIN TableB
ON TableA.item1 = TableB.item1
WHERE TableA.item2 = 'xxxx'
TableB.item2 > yyyy AND TableB.item2 < zzzz

I add the subquery to query every table before 'LEFT JOIN'
-----------------------
SELECT *
FROM
(SELECT *
FROM TableA
WHERE TableA.item2 = 'xxxx'
) TableC
LEFT OUTER JOIN
(SELECT *
FROM TableB
WHERE TableB.item2 > yyyy AND TableB.item2 < zzzz
) TableD
ON TableC.item1 = TableD.item1
WHERE TableC.item2 = 'xxxx'
TableD.item2 > yyyy AND TableD.item2 < zzzz
-----------------------

Can anyone give me some suggestion?
Thanks a lot.

Leland Huang|||lelandhuang@.gmail.com (lelandhuang@.gmail.com) writes:
> I am developing reporting service and using lots of 'LEFT OUTER JOIN',
> I am worried about the performance and want to use some subquery to
> improve
> the performance.
> Could I do that like below,
> [the origin source]
> SELECT *
> FROM TableA
> LEFT OUTER JOIN TableB
> ON TableA.item1 = TableB.item1
> WHERE TableA.item2 = 'xxxx'
> TableB.item2 > yyyy AND TableB.item2 < zzzz
> I add the subquery to query every table before 'LEFT JOIN'
> -----------------------
> SELECT *
> FROM
> (SELECT *
> FROM TableA
> WHERE TableA.item2 = 'xxxx'
> ) TableC
> LEFT OUTER JOIN
> (SELECT *
> FROM TableB
> WHERE TableB.item2 > yyyy AND TableB.item2 < zzzz
> ) TableD
> ON TableC.item1 = TableD.item1
> WHERE TableC.item2 = 'xxxx'
> TableD.item2 > yyyy AND TableD.item2 < zzzz
> -----------------------

This is a meaningless rewrite of the query, that at worst could server
to confuse the optimizer to give you a worse query plan. At best, the
optimizer will recast the second query into the first.

As Tom notes, the outer join is probably not correctly written. Assuming
that the query should read:

SELECT *
FROM TableA
LEFT OUTER JOIN TableB
ON TableA.item1 = TableB.item1
AND TableB.item2 > yyyy AND TableB.item2 < zzz
WHERE TableA.item2 = 'xxxx'

The most important for the query to perform well, is that you have a
clustered index on TableA.item2 and an index (clustered or non-clustered)
on TableB.item1.

--
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

Wednesday, March 7, 2012

How to implement the sqlserver ReportServices in ASP Page

Is it possible to use SQL Server Reporting Service in ASP Page? Anybody can help me.

No. It's a .net control. ASP can only work with ActiveX components, not .Net bases pages. It is possible to include an aspx rendered page inside asp, but then you would still need to work with asp.net. You can directly link to the reporting services web application.

How to implement the sqlserver ReportServices in ASP Page

Is it possible to use SQL Server Reporting Service in ASP Page? Anybody can help me.

No. It's a .net control. ASP can only work with ActiveX components, not .Net bases pages. It is possible to include an aspx rendered page inside asp, but then you would still need to work with asp.net. You can directly link to the reporting services web application.

Friday, February 24, 2012

how to identify the fixpack level?

hi,
for sql server 2000, how can we find the fixpack(service pack) level installed on this sql server?
is there any command, or any gui tool to identify the level?
tnksSET NOCOUNT ON
SELECT CONVERT(CHAR(25),@.@.SERVERNAME) AS 'SQL SERVER',
SUBSTRING(@.@.VERSION,23,4) AS 'PRODUCT VERSION',
SUBSTRING(@.@.VERSION,35,3) AS 'BUILD NUMBER',
CASE SUBSTRING(@.@.VERSION,35, 3)
WHEN '194' THEN 'NO SP'
WHEN '384' THEN 'SP1'
WHEN '534' THEN 'SP2'
WHEN '760' THEN 'SP3'

ELSE 'Unknown - may be a Hot-Fix version or script out of date'
END AS 'SERVICE PACK'
set nocount off|||thanks philio,
how about service pack 3a, is there an id also to distinguish it from sp3??|||SP3 and SP3a have identical build numbers (760).

Also, you can use this:

SELECT
cast(@.@.microsoftversion / power(2, 24) as varchar(2)) + '.00.' + cast(@.@.microsoftversion & 0xffff as varchar(4)) as VERSION

To derive version info...

hmscott
thanks philio,
how about service pack 3a, is there an id also to distinguish it from sp3??