used to reference a record one is updating?
Many thanksAndrew Chalk wrote:
> Is there any kind of automatic record counter in MS SQL 2005 that can
> be used to reference a record one is updating?
> Many thanks
Assuming you don't have a PK defined yet and want to use an
auto-generating number, you can add an INT/BIGINT NOT NULL column to the
table and assign it the IDENTITY property. SQL Server will automatically
assign a unique number to each row inserted into the table. Have a look
at the SCOPE_IDENTITY() function if you want to learn how to retrieve
the last generated identity value. See IDENTITY in BOL for more
information.
David Gugick - SQL Server MVP
Quest Software|||Andrew Chalk wrote:
> Is there any kind of automatic record counter in MS SQL 2005 that can be
> used to reference a record one is updating?
> Many thanks
Rows are referenced by KEYS not by "record counters". Rephrase your
question and explain what you are trying to achieve.
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
--|||I think you just made CELKO


"Andrew Chalk" <achalk@.magnacartasoftware.com> wrote in message
news:eOIhetdKGHA.720@.TK2MSFTNGP14.phx.gbl...
> Is there any kind of automatic record counter in MS SQL 2005 that can be
> used to reference a record one is updating?
> Many thanks
>sql
No comments:
Post a Comment