February 11, 2010 at 11:59 am
Hi Experts,
Can you tell me how to increment number for a particular column if same name appears again
NameID
John1
John2
Ella1
Gaby1
Gaby2
Gaby3
February 11, 2010 at 12:02 pm
Lookup Row_Number() in Books online, it is what you are looking for.
Cheers,
J-F
February 11, 2010 at 12:12 pm
No I have a database table which contains Name column and i want to create a temp Table which will hold
Name and Id column
February 11, 2010 at 12:16 pm
This is exactly what the "Row_Number()" function will allow you to do, read it up in Books Online.
Cheers,
J-F
February 11, 2010 at 12:41 pm
Awesome Kool This is what i need
March 3, 2011 at 11:44 pm
Auto Increment Field or Identity Field In MS SQL Server
Creating a Auto Increment field in SQL Server allows a unique number to be generated when a new record is inserted into a table.
Syntax for creating an Auto Increment field in SQL Server.
CREATE TABLE [dbo].[Company](
[CompanyId] [bigint] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](200) NOT NULL,
[Address] [nvarchar](max) NOT NULL,
[Phone] [nvarchar](max) NULL,
[autoBackup] [bit] NOT NULL,
[applycreditlimit] [bit] NULL,
[EmailId] [nvarchar](max) NULL,
[salesTaxPercentage] [numeric](18, 2) NULL)
Here, CompanyId has been set as an Auto Increment Id.
A column which has datatype int, big int, tiny int or small int can only be set as an Auto Increment field.
Suppose, you would like to set the AutoIncrement field (CompanyId) at the remote databases to only use the next number free AFTER the 100.
Here, CompanyId has been set as an Auto Increment Id.
A column which has datatype int, big int, tiny int or small int can only be set as an Auto Increment field.
Suppose, you would like to set the AutoIncrement field (CompanyId) at the remote databases to only use the next number free AFTER the 100.
There’s an “Identity Seed” parameter that you can specify (either through SQL or through the table designer in Enterprise Manager) that will let you set the base value for an Identity/AutoNumber field to the value you want. Any new Identity values will be incremented from this base (using the “Identity Increment” value which you can specify in the same place to determine how much to grow the value by).
If you would like to see a video as to how to set the auto increment field in SQL Server, then we have a video tutorial uplaoded at:
March 3, 2011 at 11:45 pm
Auto Increment Field or Identity Field In MS SQL Server
Creating a Auto Increment field in SQL Server allows a unique number to be generated when a new record is inserted into a table.
Syntax for creating an Auto Increment field in SQL Server.
CREATE TABLE [dbo].[Company](
[CompanyId] [bigint] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](200) NOT NULL,
[Address] [nvarchar](max) NOT NULL,
[Phone] [nvarchar](max) NULL,
[autoBackup] [bit] NOT NULL,
[applycreditlimit] [bit] NULL,
[EmailId] [nvarchar](max) NULL,
[salesTaxPercentage] [numeric](18, 2) NULL)
Here, CompanyId has been set as an Auto Increment Id.
A column which has datatype int, big int, tiny int or small int can only be set as an Auto Increment field.
Suppose, you would like to set the AutoIncrement field (CompanyId) at the remote databases to only use the next number free AFTER the 100.
Here, CompanyId has been set as an Auto Increment Id.
A column which has datatype int, big int, tiny int or small int can only be set as an Auto Increment field.
Suppose, you would like to set the AutoIncrement field (CompanyId) at the remote databases to only use the next number free AFTER the 100.
There’s an “Identity Seed” parameter that you can specify (either through SQL or through the table designer in Enterprise Manager) that will let you set the base value for an Identity/AutoNumber field to the value you want. Any new Identity values will be incremented from this base (using the “Identity Increment” value which you can specify in the same place to determine how much to grow the value by).
If you would like to see a video as to how to set the auto increment field in SQL Server, then we have a video tutorial uplaoded at:
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply