IF EXISTS(
    SELECT *
    FROM sys.columns 
    WHERE Name      = N'surfaceItemId'
      AND Object_ID = Object_ID(N'pal_SurfaceItemCode'))
BEGIN
    DROP TABLE pal_SurfaceItemCode
END

IF NOT EXISTS(
	SELECT	*
	FROM	sysobjects
	WHERE	id = OBJECT_ID(N'[dbo].[pal_SurfaceItemCode]')
			AND OBJECTPROPERTY(id,N'IsUserTable')=1)
BEGIN
	CREATE TABLE [dbo].[pal_SurfaceItemCode](
		[recId] [int] IDENTITY(1,1) NOT NULL,
		[code] [varchar](50) NULL,
		[userId] [int] NULL,
		[rangeStart] [int] NULL,
		[rangeEnd] [int] NULL,
		[lastUsed] [int] NULL,
		[status] [varchar](10) NULL,
	 CONSTRAINT [PK_pal_SurfaceItemCode] PRIMARY KEY CLUSTERED 
	(
		[recId] ASC
	)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
	) ON [PRIMARY]
END


UPDATE	M
	SET	isPicklist = 0
		,displayField = NULL
		,valueField = NULL
--SELECT	*
FROM	pal_Module M
WHERE	M.module = 'Surface Item Code'