Showing posts with label cursor. Show all posts
Showing posts with label cursor. Show all posts

Friday, March 23, 2012

have a way to change order-by of open cursor?

have a way to change order-by of open cursor?mtczx232@.yahoo.com wrote:
> have a way to change order-by of open cursor?
No but why would you want to? A cursor perhaps isn't the best solution
(cursors rarely are). Please post DDL and sample data and maybe we can
help you with an alternative.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Indeed my question is that I want understand somthing about
MSAccess with SQL server.
I know that when we open SQL server table in MSAccess, it's work
with cursor. and it's build in Automatic refrash, that ditect if some
record
DELETE by other user or APP. So my wonder, how it's posible to sort
results set by one click?
Now i check it, I try with table with 3 million rec, I link this
table to Access by ODBC, and open it. I scroll until last record
to get the Numbers of all records in result in.
and I try sort it, The MSAccess run cursor again!! I see that
the number of all records is disappear. Now clear, MSAccess
run the cursor again. Notice, during all process the RAM consuming
by MSAcess not over 25M! so the Data remain on server.
After, I Try with MSAccess Project mode. the behavior is exectly like
ADO.NET with datatable. the MSAccess consume 450M!|||mtczx232@.yahoo.com wrote:
> Indeed my question is that I want understand somthing about
> MSAccess with SQL server.
> I know that when we open SQL server table in MSAccess, it's work
> with cursor. and it's build in Automatic refrash, that ditect if some
> record
> DELETE by other user or APP. So my wonder, how it's posible to sort
> results set by one click?
> Now i check it, I try with table with 3 million rec, I link this
> table to Access by ODBC, and open it. I scroll until last record
> to get the Numbers of all records in result in.
> and I try sort it, The MSAccess run cursor again!! I see that
> the number of all records is disappear. Now clear, MSAccess
> run the cursor again. Notice, during all process the RAM consuming
> by MSAcess not over 25M! so the Data remain on server.
>
> After, I Try with MSAccess Project mode. the behavior is exectly like
> ADO.NET with datatable. the MSAccess consume 450M!
This seems to be an Access question not a SQL Server one. I'm not
certain exactly what your question is though. Unless you specify ORDER
BY in your queries SQL Server will not apply any logical ordering to
your data. Do you have an ORDER BY clause in your query?
I have to say that scrolling through 3 million rows seems like an odd
thing to do - especially in a client-server database.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||David Portas
firstable I answer my q by my self, so if you not understand my answer,
ask directly. please read the entire msg.
first, I'm sure that you have certain experience with MSAccess.
second, this question need deep knowldedge with SQL like you have.
you are right, but MSAccess do that not bad, so it's nice to get
explanation how is work! in my answer I try to give one.

Friday, February 24, 2012

Handling error level 16

Hello there
I have some store procedure that run on many views by cursor. One of the
views is failed on error level 16. And therefore the batch is being
terminated.
Is there a way not to terminate the procedure and continue?Roy Goldhammer (roy@.hotmail.com) writes:
>Date: Thu, 20 Apr 2006 10:04:29 +0200
Hey, I am in that time zone, and my watch is only 9:30!

> I have some store procedure that run on many views by cursor. One of the
> views is failed on error level 16. And therefore the batch is being
> terminated.
> Is there a way not to terminate the procedure and continue?
If you are on SQL 2000, you are basically out of luck. Some errors in SQL
Server terminates the batch, and there is no easy way to handle it.
If you are on SQL 2005, you can use the new TRY-CATCH construct.
If your aim is to run sp_refreshview on these views, search on Google
for FMTONLY + sp_refreshview. I saw a tip on that recently, but I don't
recall exactly in which newsgroup.
For more information about error handling in SQL Server, see
http://www.sommarskog.se/error-handling-I.html
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|||Whell Erland.
I'm using sql server 2000.
The main error that comes is error converting.
and it is level 16 and therefore the statement is being terminated
is there something i can do to solve it?
"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns97AB61A39F364Yazorman@.127.0.0.1...
> Roy Goldhammer (roy@.hotmail.com) writes:
> Hey, I am in that time zone, and my watch is only 9:30!
>
> If you are on SQL 2000, you are basically out of luck. Some errors in SQL
> Server terminates the batch, and there is no easy way to handle it.
> If you are on SQL 2005, you can use the new TRY-CATCH construct.
> If your aim is to run sp_refreshview on these views, search on Google
> for FMTONLY + sp_refreshview. I saw a tip on that recently, but I don't
> recall exactly in which newsgroup.
> For more information about error handling in SQL Server, see
> http://www.sommarskog.se/error-handling-I.html
> --
> 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|||Roy
What does the script do? Do you convert dates?
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:OI5duAFZGHA.4248@.TK2MSFTNGP05.phx.gbl...
> Whell Erland.
> I'm using sql server 2000.
> The main error that comes is error converting.
> and it is level 16 and therefore the statement is being terminated
> is there something i can do to solve it?
> "Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
> news:Xns97AB61A39F364Yazorman@.127.0.0.1...
>|||Roy Goldhammer (roy@.hotmail.com) writes:
> I'm using sql server 2000.
> The main error that comes is error converting.
> and it is level 16 and therefore the statement is being terminated
> is there something i can do to solve it?
The level does not matter. Error handling in SQL Server is inconsistent.
In my previous post I suggested a search, and gave a link to that article.
Rather than asking again, without telling what you are doing, why not try
the references you got?
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