Link to home
Start Free TrialLog in
Avatar of carl-
carl-

asked on

SQL Server to Sybase Create Table with IDENTITY field

Hi,
  I'm porting create table scripts from SQL Server to Sybase 15.5
what would be the equivalent of this identity field in Sybase?

CREATE TABLE [dbo].[test]
(
    TestID INT NOT NULL IDENTITY (1001, 1),
    TestName NVARCHAR(50) NOT NULL
)
GO

I'm having a problem getting the syntax for the Identity Start = 1001
Thanks
Avatar of Joe Woodhouse
Joe Woodhouse

So you want an identity column with a starting value of 1001? What size do you want the column to be able to hold? In previous versions identities were strictly numerics but you have the option in this version of having it as an integer.

If I've described your requirement correctly, in Sybase ASE you can't do this in one statement. You'd create the table with the appropriately sized identity, and then separately seed its initial value.
Avatar of carl-

ASKER

do you know the command to separately seed its initial value?
ASKER CERTIFIED SOLUTION
Avatar of alpmoon
alpmoon
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of carl-

ASKER

Thanks!!!
As a note, you can do it by sp_chgattribute as well:

sp_chgattribute [table_name], "identity_burn_max", 0, "[new_value]"

Check that discussion for further info:

https://www.experts-exchange.com/questions/23288053/How-to-reset-Identity-value-in-Sybase.html