![]() Now is time to return the column Id as the PK. ![]() When the column is added, SQL automatically fills the value based on the default order, which is determined by the Index IX_CreatedTemp. ALTER TABLE ĪDD Identit圜ol INT UNIQUE IDENTITY(1,1) NOT NULL Now SQL sort the table based on the Created column, so now I can add my Identity column. Second, I create a temporal clustered Index on Created column: CREATE CLUSTERED INDEX IX_CreatedTemp ON (Created ASC) ![]() This works only if you don't have any table related to this by the column Id, and removes at the same time the PK of Person Table. ALTER TABLE Person ADD Identit圜ol INT UNIQUE IDENTITY(1,1) NOT NULL When the column is added, SQL automatically fills the value based on the default order, which is determined by the Index IXCreatedTemp. Step 3) Type the query in the query editor: ALTER TABLE Book ADD author VARCHAR (50) Step 4) Click the Execute button. Now SQL sort the table based on the Created column, so now I can add my Identity column. Step 2) From the navigation bar on the left- Click Databases. I don't know if this is the correct way to solve my problem, but I ended with something like this:įirst, I remove the index created by SQL for PK (Column Id). To accomplish the same through pgAdmin, do this: Step 1) Login to your pgAdmin account. Is there any way to specify the Order By in ALTER sentence? | **Id** |**Name** | **Created** | Identit圜ol|īuy what I want is that create the values order by Created column. The problem is that every time when I try to do this, it adds the value of Identit圜ol, based on the default order of the table, which I suppose is defined by the column Id Person -Ĭolumn Id is the PK and a Clustered Index, so I want to add an Identity Column: ALTER TABLE
0 Comments
Leave a Reply. |