Showing posts with label method. Show all posts
Showing posts with label method. Show all posts

Friday, March 23, 2012

Link Report Builder with Visual Studio C#

How call a method of Visual Studio after close Report Builder?

Then in this method I must obtain the path and the name of created report with Report Builder.

Thanks for help me.

This is not supported. Interesting idea, though.

Monday, March 12, 2012

limiting result set from MS SQL Server Query

Hello,

I am running SQL Server 2000. I would like to know whether
Microsoft Transact-SQL has a method for limiting the result
set from a query in a way analogous to MySQL's LIMIT keyword,
so that, for instance, if the result set contains 10,000 rows,
then only the first 10 rows from the record set are output.

Thank you,

Best Regards,

Neilnzanella@.cs.mun.ca wrote:
> Hello,
> I am running SQL Server 2000. I would like to know whether
> Microsoft Transact-SQL has a method for limiting the result
> set from a query in a way analogous to MySQL's LIMIT keyword,
> so that, for instance, if the result set contains 10,000 rows,
> then only the first 10 rows from the record set are output.

Yes. You need to use the TOP clause.

In your example:

SELECT TOP 10 col1, col2, col3 FROM TABLE|||(nzanella@.cs.mun.ca) writes:
> I am running SQL Server 2000. I would like to know whether
> Microsoft Transact-SQL has a method for limiting the result
> set from a query in a way analogous to MySQL's LIMIT keyword,
> so that, for instance, if the result set contains 10,000 rows,
> then only the first 10 rows from the record set are output.

As Andrew said you can use TOP. For it to be meaningful, you need in
most cases also use an ORDER BY clause.

If you want to implement paging, there are a couple of options. One is
to use a @.last_key variable, and to:

SELECT TOP 10 ... FROM tbl WHERE keycol = @.last_key ORDER BY keycol

To implement arbitrary jumps, you can do something like:

CREATE TABLE #temp (ident int IDENTITY,
...
)

and then

INSERT #temp (...)
SELECT ...

And to get rows 41 to 60

SELECT ... FROM #temp WHERE ident BETWEEN 41 AND 60

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp