December 29, 2008 at 5:27 pm
The script used to generate a primary key :
USE [DATABASENAME]
GO
ALTER TABLE [dbo].[EmpPers] ADD CONSTRAINT [pk_EmpPers] PRIMARY KEY NONCLUSTERED
(
[EepEEID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
The primary key : 5GSMM20000K0
Can anyone explain how that primary key is generated.
Thanks !!
December 29, 2008 at 5:58 pm
That script does not generate a primary key value.
All is does is create a primary key on an existing table.
December 30, 2008 at 12:08 am
Check for existing data in the table or check how the data is getting inserted into the table.
"Keep Trying"
December 30, 2008 at 5:08 am
hi can you give your problem in brief description
Raj Acharya
December 30, 2008 at 5:17 am
metro17 (12/29/2008)
The script used to generate a primary key :USE [DATABASENAME]
GO
ALTER TABLE [dbo].[EmpPers] ADD CONSTRAINT [pk_EmpPers] PRIMARY KEY NONCLUSTERED
(
[EepEEID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
The primary key : 5GSMM20000K0
Can anyone explain how that primary key is generated.
Thanks !!
Can u tell me, exactly what u facing?
December 30, 2008 at 6:44 am
Hi,
i m also asking same thing
call me i will explain you that
Raj Acharya
December 30, 2008 at 8:22 am
metro17 (12/29/2008)
The script used to generate a primary key :USE [DATABASENAME]
GO
ALTER TABLE [dbo].[EmpPers] ADD CONSTRAINT [pk_EmpPers] PRIMARY KEY NONCLUSTERED
(
[EepEEID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
The primary key : 5GSMM20000K0
Can anyone explain how that primary key is generated.
Thanks !!
Primary Key is generated by creating an Unique Index and setting a Primary Key Constraint on top of it.
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.December 30, 2008 at 8:28 am
if you are looking for the script that create '5GSMM20000K0' as your primary key, then that is not the right one. All that does in define the column in your table, you will need to have another look at your db to find the correct script..
December 30, 2008 at 1:45 pm
Data type is char(12) does not allow nulls .
Eg of a few primary keys...
3BQWDL0000K0
3BQWEB0000K0
3BQWEX0000K0
Is there any formula behind it that is generating this ? If so how do I find out that formula in Sql sserver management studio which is what i am using
Thank you
December 30, 2008 at 2:07 pm
metro17 (12/30/2008)
Data type is char(12) does not allow nulls .Eg of a few primary keys...
3BQWDL0000K0
3BQWEB0000K0
3BQWEX0000K0
Is there any formula behind it that is generating this ? If so how do I find out that formula in Sql sserver management studio which is what i am using
Thank you
There sure must be some sort of logic to generate such values but that code snippet you've posted almost certainly does not generate these values. 😉
You should look for the code that inserts data into that table to find out how things happen.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
December 31, 2008 at 12:05 am
hi as per you told that if you want to check for this particular column of primary key then right click on table and click on design and now click on primary key column and check column property is there any default value or formula added into that or not
Raj Acharya
December 31, 2008 at 8:21 am
raj acharya (12/31/2008)
hi as per you told that if you want to check for this particular column of primary key then right click on table and click on design and now click on primary key column and check column property is there any default value or formula added into that or not
Agreed - that kind of looks like NEWSEQUENTIALID() to me.... check the default value for that column.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply