Showing posts with label numbering. Show all posts
Showing posts with label numbering. Show all posts

Monday, March 19, 2012

Automatic page numbering

We are using Crystal 10 and at the bottom of each page are using the automatic page numbering (page X of XX) . We have a report footer that only occurs on the last page of the report. When the last page contains only this footer, the automatic page numbering does not work properly. The first page says 1 of 1 and the second page also says 1 of 1. The automatic page numbering does not pick up on the fact that the report has 2 pages and generate the numbers properly. Any suggestions.Use this forumula

WhilePrinitingRecords;
Numbervar N;
N:=N+1'
And place this in Report footer

Monday, February 13, 2012

Auto numbering field similar to

I've been using MS Access 2000 for a while and have recently switched to MS
SQL 2000. When creating a primary key I am used to MS Access ability to auto
matically enter a number in the ID field when I enter data into my tables.
Does MS SQL have a feature similar to this? I checked all the data types and
the only thing that I see that is close to autonumber is uniqueidentifier. Is
that the same thing?
Walker_Michael wrote:
> I've been using MS Access 2000 for a while and have recently switched
> to MS SQL 2000. When creating a primary key I am used to MS Access
> ability to auto matically enter a number in the ID field when I enter
> data into my tables. Does MS SQL have a feature similar to this? I
> checked all the data types and the only thing that I see that is
> close to autonumber is uniqueidentifier. Is that the same thing?
No, not really. What you want is an IDENTITY column (attached to a
numeric data type) as in:
Create Table Customers (
CustID INT IDENTITY NOT NULL )
Unique identifiers can be used as well, but you need to generate the
number manually using the newid() function. They consists of a 16-byte
hexadecimal number (GUID). Some SQL Server users use them as keys. They
are used frequently in replication. The INT IDENTITY can accommodate
more than 2 Billion values and is only 4-bytes as opposed to 16.
The return the last identity value inserted, you should use
scope_identity(). From a stored procedure, you could use:
Create Proc dbo.UpdateCustomer
@.CustID INT OUTPUT,
@.CustName VARCHAR(50
as
Begin
If @.CustID IS NOT NULL
Update dbo.Customers
Set CustName = @.CustName
Where CustID = @.CustID
Else
Begin
Insert dbo.Customers (
CustName)
Values (
@.CustName )
Set @.CustID = SCOPE_IDENTITY()
End
End
To call this procedure:
Declare @.CustID INT
Exec dbo.UpdateCustomer @.CustID OUTPUT, 'David Gugick'
Select @.CustID
David Gugick
Imceda Software
www.imceda.com

auto numbering

plz tell me how to make a column(id)that is a primary key to be auto numbered .

Hi,

you have to create a new column with the identity property and copy the primary key values over to the identity column, then drop the old non-identity column.

There is no ALTER Column or ALTER table to do this.


HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

auto numbering

Hello,

For analyses and reporting I would like to add a 'ranking' to a
table/view.
Example:
Using the 'order by desc' clause in query I get a list of Customers
ordered by Turnover (descending). I would like to add that ranking
numbers (same as recordnumbers) in the query. I would like to have the
following result:
Cust_nr Cust_Name Turnover_2004 Ranking
002234 Bayer 139.000 1
003456 Rentokill 123.456 2
001231 Air France 105.000 3
etc.

When the 'ranking' is part of the query/table I can use this ranking in
an other query.

Important: This questions is not about making an (empty) table structure
for filling in by an application and generating a new unique number each
time a record is added.

I hope you can help me.

Thanks,

Hans

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!On 10 Mar 2005 03:14:43 -0600, Hans de Korte wrote:

>Hello,
>For analyses and reporting I would like to add a 'ranking' to a
>table/view.
>Example:
>Using the 'order by desc' clause in query I get a list of Customers
>ordered by Turnover (descending). I would like to add that ranking
>numbers (same as recordnumbers) in the query. I would like to have the
>following result:
>Cust_nr Cust_Name Turnover_2004 Ranking
>002234 Bayer 139.000 1
>003456 Rentokill 123.456 2
>001231 Air France 105.000 3
>etc.
>When the 'ranking' is part of the query/table I can use this ranking in
>an other query.
(snip)

Hi Hans,

I'd recommend against storing it in the table, as you'll need to update
all rankings each time some data in the table changes. (Of course, if
you have a static database, where data won't change but that you have to
run extensive reports off, things change).

In a live database, I'd define a view to hold the ranking:

CREATE VIEW CustomersRanked
AS
SELECT Cust_nr, Cust_Name, Turnover_2004,
(SELECT COUNT(*)
FROM Customers AS b
WHERE b.Turnover_2004 > a.Turnover_2004) + 1 AS Ranking
FROM Customers AS a
ORDER BY Turnover_2004 DESC
(untested)

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thanks, the soluttion is working excellent!!

Regards,

Hans

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!