Sunday, March 25, 2012
Automatically increasing field definition by SQL
ThanksCreate table a
(
name varchar2(100)
);
Alter table a
modify name varchar2(200);|||Are you asking how to create a column that will increase in value, or increase in size? If you are looking to create something analagous to Oracle's rowid, the syntax is different for each database engine, so you'll have to tell us which engine you are using for us to give you one answer.
-PatP|||It's on ACCESS.|||Originally posted by anat_sher
It's on ACCESS. That's helpful, but are you looking for an MS-Access AUTONUMBER (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/acconWhichTypeAutoNumberFieldCreate.asp) column, or a TEXT column that will increase in length each time you do something?
-PatP|||AUTONUMBER please..
It's not on ACCESS really, it's on a SQL server. But I figured it's about he same. No?|||create table tableA
(
id INTEGER IDENTITY(1, 1)
...
)
Thursday, March 22, 2012
Automatically Defining Primary keys
Hi,
I am new to SQL Server platform, i want to define primary keys automatically other than using an identity. For a table called indicator i want it primary keys to be like ind_001, ind_002, ind_003 and so on.
Can anybody help me on how to do this? I am new to this platform so i will appreciate it if suggestions are explained very clearly. Thank you
You will either have implement this in your fronent logic or use triggers to reset the values inserted to the appropiate pattern.
Jens K. Suessmeyer
http://www.sqlserver2005.de
Monday, March 19, 2012
Automatic Fields
it's possibile to define table fields for automatic Last_Update_Date and for
Creation_date using column formula??
Thanks !!!hmario wrote:
Quote:
Originally Posted by
it's possibile to define table fields for automatic Last_Update_Date and for
Creation_date using column formula??
You can create regular columns, and write (fairly simple) insert and
update triggers to populate them appropriately. I don't know a simpler
way to do it.|||Hi.
Ok, I do it with triggers, Thanks !!
"Ed Murphy" <emurphy42@.socal.rr.comha scritto nel messaggio
news:PqH6h.705$Fg.383@.tornado.socal.rr.com...
Quote:
Originally Posted by
hmario wrote:
>
Quote:
Originally Posted by
>it's possibile to define table fields for automatic Last_Update_Date and
>for Creation_date using column formula??
>
You can create regular columns, and write (fairly simple) insert and
update triggers to populate them appropriately. I don't know a simpler
way to do it.
Monday, February 13, 2012
auto number?
data is growing near 2147483647? Thanks.The simplest solution is to change the data type on the column to BigInt.
Thomas
"js" <js@.someone@.hotmail.com> wrote in message
news:%23BzLMyNUFHA.2096@.TK2MSFTNGP14.phx.gbl...
> Hi, I define a field as auto number field, usually how people deal with if
> data is growing near 2147483647? Thanks.
>
>|||Are you talking about access (--> autonumber) or SQl server (->identity)
Identities at sql serv can store up to
+-2^63-1 (9223372036854775807)
HTH, Jens SUessmeyer.
"js" <js@.someone@.hotmail.com> schrieb im Newsbeitrag
news:%23BzLMyNUFHA.2096@.TK2MSFTNGP14.phx.gbl...
> Hi, I define a field as auto number field, usually how people deal with if
> data is growing near 2147483647? Thanks.
>
>|||is it any archive function avaliable?
"Thomas Coleman" <replyingroup@.anywhere.com> wrote in message
news:uPOzm2NUFHA.3344@.TK2MSFTNGP10.phx.gbl...
> The simplest solution is to change the data type on the column to BigInt.
>
> Thomas
> "js" <js@.someone@.hotmail.com> wrote in message
> news:%23BzLMyNUFHA.2096@.TK2MSFTNGP14.phx.gbl...
>|||That's big...
So I can just design it and forget it, assume not problem at all?
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:eE%23uB3NUFHA.4056@.TK2MSFTNGP15.phx.gbl...
> Are you talking about access (--> autonumber) or SQl server (->identity)
> Identities at sql serv can store up to
> +-2^63-1 (9223372036854775807)
> HTH, Jens SUessmeyer.
> "js" <js@.someone@.hotmail.com> schrieb im Newsbeitrag
> news:%23BzLMyNUFHA.2096@.TK2MSFTNGP14.phx.gbl...
>|||As far as you wont reach 9223372036854775807 and your client app can handle
that, no.
Jens Suessmeyer.
"js" <js@.someone@.hotmail.com> schrieb im Newsbeitrag
news:e1MXhCOUFHA.3140@.TK2MSFTNGP14.phx.gbl...
> That's big...
> So I can just design it and forget it, assume not problem at all?
>
>
> "Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote
> in message news:eE%23uB3NUFHA.4056@.TK2MSFTNGP15.phx.gbl...
>|||I'm think of archive the data and reset the seed? what other people handle
that? Thanks.
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:ebWIfGOUFHA.1796@.TK2MSFTNGP15.phx.gbl...
> As far as you wont reach 9223372036854775807 and your client app can
> handle that, no.
> Jens Suessmeyer.
> "js" <js@.someone@.hotmail.com> schrieb im Newsbeitrag
> news:e1MXhCOUFHA.3140@.TK2MSFTNGP14.phx.gbl...|||I would not recommend that solution. I would instead recommend using a BigIn
t
for the data type of your identity column. If that table gets big, then by a
ll
means archive some of the data into a different table. But I would not chang
e
the identity values nor the seed when I archived the data.
Thomas
"js" <js@.someone@.hotmail.com> wrote in message
news:%23C3l1JOUFHA.3532@.TK2MSFTNGP09.phx.gbl...
> I'm think of archive the data and reset the seed? what other people handle
> that? Thanks.
> "Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote i
n
> message news:ebWIfGOUFHA.1796@.TK2MSFTNGP15.phx.gbl...
>|||> I'm think of archive the data and reset the seed? what other people handle
> that? Thanks.
What? How often do you plan on archiving? If you have three archives and
all have a row where idNumber = 1, which one is the one you're looking for?
If you are building a system where you really think you will need to reset
the IDENTITY value, perhaps you are going about this the wrong way
altogether.|||I agree with that now...
"Thomas Coleman" <replyingroup@.anywhere.com> wrote in message
news:%235ODlQOUFHA.3544@.TK2MSFTNGP12.phx.gbl...
>I would not recommend that solution. I would instead recommend using a
>BigInt for the data type of your identity column. If that table gets big,
>then by all means archive some of the data into a different table. But I
>would not change the identity values nor the seed when I archived the data.
>
> Thomas
> "js" <js@.someone@.hotmail.com> wrote in message
> news:%23C3l1JOUFHA.3532@.TK2MSFTNGP09.phx.gbl...
>