SQLTeam.com | Weblogs | Forums

Inserting Rows


#1

I was trying to insert the rows into one of the tables, and one of the GUID (Primary Key) cannot be inserted as it is generated automatically (no idea how) . . Is it allowable to do an insert ? Right now we are using a 4 hour process plus at least 3 people working instead we can make it one person with fraction of seconds.


#2

Show us the DDL for the table. Are you sure the PK is a GUID and not an IDENTITY column?


#3

GUID numeric(16,0) nulls(Yes) Primary key; unique identifier.

The table values are and so on
GUID

185599102990
185599202990
185599302990
185599402990
185599502990
185599602990
185599702990
185599802990


#4

Show us the CREATE TABLE statement. What you posted is not a GUID/unique identifier. It appears it's an IDENTITY column that uses a 100000 increment.

This is what a uniqueidentifier looks like: 6F9619FF-8B86-D011-B42D-00C04FC964FF.


#5

I cannot get the DDL statement, but here are the details of the columns of the table

SiteID smallint
RepFlags tinyint
Build int
TouchedBy varchar(50)
TouchedWhen datetime
CreatedBy varchar(50)
CreatedWhen datetime
Active bit
GUID dbo.HVCIDdt:numeric(16, 0)
CatalogItemTaskGUID dbo.HVCIDdt:numeric(16, 0)
LocationGroupGUID dbo.HVCIDdt:numeric(16, 0)
MSrepl_tran_version uniqueidentifier


#6

Unfortunately that didn't help. Just right click on the table, select "Script Table as", "CREATE To" and then "Clipboard". Paste it here.

This will show us if GUID is an IDENTITY or not.

Alternatively, you could show us the error when you try to do an insert.


#7
USE [CR2DEV29Daily]
GO

/****** Object:  Table [dbo].[CV3CatalogTaskLocationXRef]    Script Date: 12/15/2015 1:01:31 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[CV3CatalogTaskLocationXRef](
	[SiteID] [smallint] NULL DEFAULT ([dbo].[SCMSiteIDFn]()),
	[RepFlags] [tinyint] NULL DEFAULT ((0)),
	[Build] [int] NOT NULL,
	[TouchedBy] [varchar](50) NULL,
	[TouchedWhen] [datetime] NULL DEFAULT (getdate()),
	[CreatedBy] [varchar](50) NULL,
	[CreatedWhen] [datetime] NULL DEFAULT (getdate()),
	[Active] [bit] NOT NULL,
	[GUID] [dbo].[HVCIDdt] NOT NULL,
	[CatalogItemTaskGUID] [dbo].[HVCIDdt] NULL,
	[LocationGroupGUID] [dbo].[HVCIDdt] NULL,
	[MSrepl_tran_version] [uniqueidentifier] NULL DEFAULT (newid()),
 CONSTRAINT [CV3CatalogTaskLocationXRefPK] PRIMARY KEY NONCLUSTERED 
(
	[GUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

#8

It appears you have a user-defined data type called [dbo].[HVCIDdt]. Locate the user-defined data type and show us the code. It's under Programmability/Types/User-Defined Data Types.


#9

Thank you, I will post the insert query, I have to get 3 different values from other 4 tables to insert to this,