Reset Page count, use distinctcount() for page number, or SPROC cursor to reset page number????????
I have a report that will come back as 20 pages.What the user wants is on the beginning of another unique ID, which causes a new page to be started, to have the page count restart to 1.So, if I have 3 UniqueIDs for all 20 pages, and the first, IDAA, is 10 pages long, the second, IDBB, is 4 pages long, and the third, IDCC, is 6 pages long, then the page numbering would be as:1-10 for IDAA1-4 for IDBB1-6 for IDCCI've been told to set a cursor in a SP that determines what page I'm on and then passses this to the result set as a column. This is then set in a group to control...How to get RANDOM numbers in a cursor?
I have the following stored procedure:
drop procedure test;
create procedure test
declare @test2 numeric(8)
Declare test_cursor cursor
for SELECT test2
for UPDATE of test2
fetch test_cursor into @test2
while (@@sqlstatus = 0)
set test2 = ( select round( (rand(6) * 10000000),0) )
where test2 = @test2
fetch test_cursor into @test2
Why does the rand end up always putting the same value into the column in
the entire table? How do I make it randomize the value and not repeat???????
Thank you i...How to get port number used?
Currently using qpsmtpd 0.32 in forkserver mode.
I would like to know if it is possible for a plugin to determine which
port a connection came in on, so that it could be treated differently
from connections on other ports.
On 14-Jul-07, at 9:37 PM, email@example.com wrote:
> Currently using qpsmtpd 0.32 in forkserver mode.
> I would like to know if it is possible for a plugin to determine which
> port a connection came in on, so that it could be treated differently
> from connections on other ports.
$qp->connection->local_port tells you...TEdit how to get cursor position?
How to find cursor position so that it was moving along with the appearing signs? I would like to use this function
SendMessage( Edit1->Handle, EM_SETSEL, pos, Edit1->Text.Length()); but I have a problem with the variable 'pos'. because the position of the cursor can also change with the mouse and then I do not know what value to assign it.
You can retrieve Edit1 character start position with
Edit1->Perform(EM_GETSEL, reinterpret_cast<unsigned>(&Pos), 0);
...Trying to get away from using a cursor
I have a situation in which I need to update one field in one table from
concatenated data from multiple rows on a secondary table and I know I can
do it with a cursor but I'm trying to fugure out if I can do it without
using a cursor.
Here's the basic scenario
1 Joe null null
2 Smith null null
1 adult 10...Get the row number when using gridview
Hi guys, I am using a gridview presently and have a checkbox in each row. If I select this and then delete the row, on page reload I want the next checkbox in line to be selected. This is not necessarily the first row in the gridview.What I need to know is how can I determine the row number of my grdivew where the checkbox is ticked. The workflow will be something like this. 'Get selected row number 'Set as a session variable'Delete row'On page reload go to the sessionvariable value - 1 rowEnable the checkbox for that given row.Any ideas?THanks in advancep.Smy ...To Use Cursor or Not to Use, What is the answer ??
"Falling back on cursors because they remind you of datasets will result in poor performance "
Hi, The above quote was from an article which advice to use store procedure and avoid T-sql in the body of a webpage.
Anyway, To me, I always use cursor when I want to process one row at a time. Is there an alternative to cursor in MS sql server to have similar results.?
AlNew to Asp.net
One approach I've seen is to instead use a #TEMP table, create a loop, and process the TOP 1 record in the table, deleting the record at the bottom of the loop.
C...Getting the most common used numbers from access database
Today has been a bummer because i am usually faily confident with sql statements but i just can't seem to figure out the format. Basically i want data to be drawn from the same database and same table. Although i want to find out the 6 most common numbers in all 6 columns in my table. I've tried the count(*) method but it only seems to work on one column, not all of them and i can only serach for 1 number at the mo, not all the numbers.
Does anybody out there know how to count the numbers which come from all 6 columns(fields) and then display only the 6 highest amoun...Get Column Number Using Column Name
This ones burning me because, I am sure i've done it before and It's simply
slipping my mind.
I need to be able to get a column number using the column name.
i.e. Column name = 'effective_date'.
Using effective date - get the column number that belongs to effective
Any help is appreciated!!
> This ones burning me because, I am sure i've done it before and It's simply
> slipping my mind.
...Which to use to get results of number of rows in a query?
kind of confused on which command to use like sqldatareader or sqldataadaptor, etc to get query.. i understand datareader is faster? but it does not return me the results of number of rows it query right? Unless i do a while loop and query thru the whole thing?
Or what should i use to simply just get the total number of records from a sql query?
::Or what should i use to simply just get the total number of records from a sql query?
Read the data.
This is the same thing other solutions do.
SQL Servers nver know the exact number of rows of a query until they are finished. Did th...Getting error message using error number
This probably is a silly question -
Can anybody tell me how to trap an error message that is returned from
the database inside a stored procedure? I am able to trap the error
using the global var @@error, but dont seem to find any such thing for
the text of the error message. I also am able to get the text of the
corresponding error number from master..sysmessages, but then, the
placeholders are empty.
Any help is appreciated
Arviind Rajan wrote:
> This probably is a silly question -
> Can anybody tell me how to trap an error message that is returned from
...get number of rows in a table and use it as a variable: help
I need to get the number of rows in a mySQL table and use the resulting number as a variable to set the MAX range value ofDim id As Int32Dim rand As New Random()
id = rand.Next(1, 10).ToString()
to get the rows i use
Dim strQueryROWS As String = "select count(*) from uploads"
how do i return the result of this as an int i can then use? thanks for any help-luke"with every fix comes a new bug"
// 1. Instantiate a new command SqlCommand cmd = new SqlCommand("select count(*) from Categories", conn); // 2. Call E...How to get the Sequence number without using temp table
Here is my problem:
I have a table with following columns:
PersonID FirstName LastName
102 John Ben
103 Josh Parker
104 Mark Ben
Now if I type SELECT * FROM Person WHERE LastName = 'Ben' these two records will be displayed
PersonI...using cursor to get a row count for all user tables...
Please help me troubleshoot the below code. I'm trying to
convert it over from MS SQL Server to Sybase. The MS SQL
Server code is very similar to Sybase ASE, but different in
places. I'm hoping that the below code is correct and will
work on ASE, but was hoping to get your feedback. Is there
a better way to do this?
declare table_cursor cursor
for select name from sysobjects where type='U'
for read only
declare @table_name sysname
set @total_recs = 0