Thought I'd post the whole problem I'm trying to solve -- seems like it's
common enough that there must be a "normal" way to do this.
I want to say "select the top 2000 rows, starting at row 15000, from myTable
order by foo". I know I could use SELECT TOP 17000... to limit the number of
rows returned, but I'm still pulling a ton more data than I need.
So I thought I'd do it with a UDF, but I thought I'd see if there was a good
one already written for this.
Thanks!Jesse wrote:
> Thought I'd post the whole problem I'm trying to solve -- seems like
> it's common enough that there must be a "normal" way to do this.
> I want to say "select the top 2000 rows, starting at row 15000, from
> myTable order by foo". I know I could use SELECT TOP 17000... to
> limit the number of rows returned, but I'm still pulling a ton more
> data than I need.
> So I thought I'd do it with a UDF, but I thought I'd see if there was
> a good one already written for this.
> Thanks!
Select Top 2000
From dbo.MyTable
Where MyCol >= 15000
Order By Foo
Unless you have some column in the table that is numbered, there is no such
thing as "row 15000". Rows are not positional. In SQL 2005, you can assign
row numbers to the columns in the query using hte ROW_NUMBER() function.
David Gugick
Quest Software|||Thanks, David --
You're right, if the query isn't sorted. But if you specify an ORDER BY
clause, then there is a definite Nth row. (If the data changes, the Nth row
may change as well, but for my purposes, that's OK.)
In your example, if you can stop at the 2,000th row returned from an ordered
query (SELECT TOP 2000), it follows that you could skip over the first N of
them.
Jesse
> Select Top 2000
> From dbo.MyTable
> Where MyCol >= 15000
> Order By Foo
> Unless you have some column in the table that is numbered, there is no
> such thing as "row 15000". Rows are not positional. In SQL 2005, you can
> assign row numbers to the columns in the query using hte ROW_NUMBER()
> function.
>
> --
> David Gugick
> Quest Software
>
Showing posts with label solve. Show all posts
Showing posts with label solve. Show all posts
Thursday, March 8, 2012
Sunday, February 19, 2012
"Invalid character in the given encoding". XML bulk load, SQLE
Hi Martin,
I confirm that the problem is the presence of the character "è", even if it
is in the comment. How can I solve the problem?
I have put the line
<?xml version="1.0" encoding="utf-8"?>
for the encoding. What else should I do?
"Martin Honnen" wrote:
> Tatopitta wrote:
>
> The error usually means that a byte sequence has been encountered that
> does not map to a character in the specified encoding in the XML
> declaration.
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/
>Tatopitta wrote:
> I confirm that the problem is the presence of the character "è", even if
it
> is in the comment. How can I solve the problem?
> I have put the line
> <?xml version="1.0" encoding="utf-8"?>
> for the encoding. What else should I do?
Make sure the document is really UTF-8 encoded, with UTF-8 the character
"è" needs to be encoded with the two byte sequence C3 A8.
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
I confirm that the problem is the presence of the character "è", even if it
is in the comment. How can I solve the problem?
I have put the line
<?xml version="1.0" encoding="utf-8"?>
for the encoding. What else should I do?
"Martin Honnen" wrote:
> Tatopitta wrote:
>
> The error usually means that a byte sequence has been encountered that
> does not map to a character in the specified encoding in the XML
> declaration.
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/
>Tatopitta wrote:
> I confirm that the problem is the presence of the character "è", even if
it
> is in the comment. How can I solve the problem?
> I have put the line
> <?xml version="1.0" encoding="utf-8"?>
> for the encoding. What else should I do?
Make sure the document is really UTF-8 encoded, with UTF-8 the character
"è" needs to be encoded with the two byte sequence C3 A8.
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
Saturday, February 11, 2012
"Connection busy with another hstmt" and RIMS
Hello all,
We've got a problem which we've been trying to solve for three days now, to no avail. We're trying to set up RIMS 7.1.2 on a bunch of desktops, connecting to an SQL 6.5 database on an NT4 server. The desktops are all running Windows 98 2E.
Every time we try to launch RIMS, we get the error "Connection is busy with the results of another hstmt". This happens right after we double-click the RIMS icon, before we can even log in.
We have tried upgrading the MDAC version we were using to 2.7, but that didn't help. We even tried using older versions of the sqlsrv32.dll and odbcbcp.dll files (we found a MSKB article saying that MDAC 2.6 and 2.7 could cause this error on SQL 2000, and it specified these files). We've tried reinstalling. _Nothing_ seems to be working.
The only other thing we could think of was that maybe it has to do with the fact that the desktops have the SQL 7.0 client while the server has 6.5?
_Any_ help on this one would be greatly appreciated. We're stuck...Is it this error ? "Connection is busy with results for another hstmt" Which service pack of sql server 6.5 are you running (service pack 1 fixed an error like this) ?|||We are running 5a on the server. I don't think we're running any service packs on the clients or for the RIMS software, though...|||Is the application using both sql servers ? Have you been successful before installing this application or is this a first installation ? Is there a reason why the server is 6.5 and not 7/2000 ? Do you know what the code was written in ? This issue could be caused by software or database. Have you contacted the vendor ?|||We've never had a problem installing it before. The reason we're using 6.5 is that everytime we upgrade, we apparently have to do a major overhaul of the database. Don't know what the application is written in -- I'll see if I can find that out.
The company said to try using Named Pipes as the connection protocol instead of TCP/IP, and we did try that but it didn't fix the problem.
The boxes are all on a secure network. We're going to try connecting one of them to the main network and see if we can make it work. That should at least give us a better idea of whether it's a server problem or a problem with the desktop...
<sigh>
We've got a problem which we've been trying to solve for three days now, to no avail. We're trying to set up RIMS 7.1.2 on a bunch of desktops, connecting to an SQL 6.5 database on an NT4 server. The desktops are all running Windows 98 2E.
Every time we try to launch RIMS, we get the error "Connection is busy with the results of another hstmt". This happens right after we double-click the RIMS icon, before we can even log in.
We have tried upgrading the MDAC version we were using to 2.7, but that didn't help. We even tried using older versions of the sqlsrv32.dll and odbcbcp.dll files (we found a MSKB article saying that MDAC 2.6 and 2.7 could cause this error on SQL 2000, and it specified these files). We've tried reinstalling. _Nothing_ seems to be working.
The only other thing we could think of was that maybe it has to do with the fact that the desktops have the SQL 7.0 client while the server has 6.5?
_Any_ help on this one would be greatly appreciated. We're stuck...Is it this error ? "Connection is busy with results for another hstmt" Which service pack of sql server 6.5 are you running (service pack 1 fixed an error like this) ?|||We are running 5a on the server. I don't think we're running any service packs on the clients or for the RIMS software, though...|||Is the application using both sql servers ? Have you been successful before installing this application or is this a first installation ? Is there a reason why the server is 6.5 and not 7/2000 ? Do you know what the code was written in ? This issue could be caused by software or database. Have you contacted the vendor ?|||We've never had a problem installing it before. The reason we're using 6.5 is that everytime we upgrade, we apparently have to do a major overhaul of the database. Don't know what the application is written in -- I'll see if I can find that out.
The company said to try using Named Pipes as the connection protocol instead of TCP/IP, and we did try that but it didn't fix the problem.
The boxes are all on a secure network. We're going to try connecting one of them to the main network and see if we can make it work. That should at least give us a better idea of whether it's a server problem or a problem with the desktop...
<sigh>
Subscribe to:
Posts (Atom)
