Showing posts with label row. Show all posts
Showing posts with label row. Show all posts

Wednesday, March 28, 2012

Resetting rows count

I have a table in Database where I have added and removed rows, during the
period of developing applications. Now I have removed all row, but when new
are added, their IDs don't start from 1.
Is there a way to reset some counter or something?
hi Nikolay,
"Nikolay Petrov" <johntup2@.mail.bg> ha scritto nel messaggio
news:%23AvGpW5gEHA.1184@.TK2MSFTNGP12.phx.gbl...
> I have a table in Database where I have added and removed rows, during the
> period of developing applications. Now I have removed all row, but when
new
> are added, their IDs don't start from 1.
> Is there a way to reset some counter or something?
>
you are probably referring to a table colum's property known as IDENTITY...
in order to reset it's internal value, you can have a look at the DBCC
CHECKIDENT
(..)http://msdn.microsoft.com/library/de.../en-us/tsqlref
/ts_dbcc_5lv8.asp action...
if you want to delete all rows from a user table and reset the IDENTITY
property on the same time, you can issue a TRUNCATE TABLE statement instead
of DELETE FROM...
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Wednesday, March 21, 2012

Reseed Identity of Existing

Hey all,
Is there an easy way to reseed an identity column while retaining all of
the data within each row?
This doesn't really make much of a difference since it doesn't affect
anything 'operationally'; just curious more than anything else.
I read several posts here and checked DBCC_CHECKIDENT but wasn't sure about
the impact to existing.
Thanks.
--
Message posted via http://www.sqlmonster.comDBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
As long as you don't reset it to a value lower than the maximum existing
identity value, you are ok.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"The Gekkster via SQLMonster.com" <forum@.nospam.SQLMonster.com> wrote in
message news:c25abe6eaa404a5b8ef9e7aff85038f2@.SQLMonster.com...
> Hey all,
> Is there an easy way to reseed an identity column while retaining all of
> the data within each row?
> This doesn't really make much of a difference since it doesn't affect
> anything 'operationally'; just curious more than anything else.
> I read several posts here and checked DBCC_CHECKIDENT but wasn't sure
> about
> the impact to existing.
> Thanks.
> --
> Message posted via http://www.sqlmonster.com|||Thanks, Mike.
I was actually wondering about the ability to 'include' existing rows. In
other words, to also automatically 're-number' existing rows beginning with
the RESEED value used in executing DCCC_CHECKIDENT.
--
Message posted via http://www.sqlmonster.com

Tuesday, February 21, 2012

Reposition Subtotals

Hi,
I have created a very simple tabular report with only one row group which I
have enabled subtotals on. What I am not enjoying is that the subtotals
seem to HAVE to be at the top of the group:
Below is an example. The DEPT header is the row group.
DEPT |INV_NO |VALUE
--
TX10 | - | £600.00
| SI123456 | £200.00
| SI123457 | £200.00
| SI123458 | £200.00
MX10 | - | £900.00
| SI123456 | £300.00
| SI123457 | £300.00
| SI123458 | £300.00
HX10 | - | £300.00
| SI123456 | £100.00
| SI123457 | £100.00
| SI123458 | £100.00
In the above example the subtotal for the group is in the same line as the
row name. Is there a way of getting it to be positioned at the bottom? For
example:
DEPT |INV_NO |VALUE
--
TX10 | - |
| SI123456 | £200.00
| SI123457 | £200.00
| SI123458 | £200.00
| | £600.00
TIA,
JarrydWhen you define a group, by default it shows you the group header, detail
line and group footer.
Have you tried to put subtotals in the group footer?
"Jarryd" <jarryd@.community.nospam> escribió en el mensaje
news:uUWbDFEKIHA.1164@.TK2MSFTNGP02.phx.gbl...
> Hi,
> I have created a very simple tabular report with only one row group which
> I have enabled subtotals on. What I am not enjoying is that the subtotals
> seem to HAVE to be at the top of the group:
> Below is an example. The DEPT header is the row group.
> DEPT |INV_NO |VALUE
> --
> TX10 | - | £600.00
> | SI123456 | £200.00
> | SI123457 | £200.00
> | SI123458 | £200.00
> MX10 | - | £900.00
> | SI123456 | £300.00
> | SI123457 | £300.00
> | SI123458 | £300.00
> HX10 | - | £300.00
> | SI123456 | £100.00
> | SI123457 | £100.00
> | SI123458 | £100.00
> In the above example the subtotal for the group is in the same line as the
> row name. Is there a way of getting it to be positioned at the bottom?
> For example:
> DEPT |INV_NO |VALUE
> --
> TX10 | - |
> | SI123456 | £200.00
> | SI123457 | £200.00
> | SI123458 | £200.00
> | | £600.00
> TIA,
> Jarryd
>|||GENIUS!! I knew it had to be something simple. Thanks a mil!
Jarryd
"Mónica" <monica.diaz@.augure.com> wrote in message
news:ejsd0hEKIHA.4752@.TK2MSFTNGP05.phx.gbl...
> When you define a group, by default it shows you the group header, detail
> line and group footer.
> Have you tried to put subtotals in the group footer?
>
> "Jarryd" <jarryd@.community.nospam> escribió en el mensaje
> news:uUWbDFEKIHA.1164@.TK2MSFTNGP02.phx.gbl...
>> Hi,
>> I have created a very simple tabular report with only one row group which
>> I have enabled subtotals on. What I am not enjoying is that the
>> subtotals seem to HAVE to be at the top of the group:
>> Below is an example. The DEPT header is the row group.
>> DEPT |INV_NO |VALUE
>> --
>> TX10 | - | £600.00
>> | SI123456 | £200.00
>> | SI123457 | £200.00
>> | SI123458 | £200.00
>> MX10 | - | £900.00
>> | SI123456 | £300.00
>> | SI123457 | £300.00
>> | SI123458 | £300.00
>> HX10 | - | £300.00
>> | SI123456 | £100.00
>> | SI123457 | £100.00
>> | SI123458 | £100.00
>> In the above example the subtotal for the group is in the same line as
>> the row name. Is there a way of getting it to be positioned at the
>> bottom? For example:
>> DEPT |INV_NO |VALUE
>> --
>> TX10 | - |
>> | SI123456 | £200.00
>> | SI123457 | £200.00
>> | SI123458 | £200.00
>> | | £600.00
>> TIA,
>> Jarryd
>