Jump to content

SQL - Msg 2705, Level 16, State 3

- - - - -

  • Please log in to reply
3 replies to this topic

#1
stevie754

stevie754

    Programmer

  • Members
  • PipPipPipPip
  • 110 posts
Hi guys, firstly let me start by saying I have never used SQL before and this is probably a really easy fix. I just don't know where to look because as I said I'm a complete novice.
I am working in MSS and have already created several new views that have all been tested and work, I have now got to create 2 new tables to add into the database.


PRINT '|'

PRINT '|  TABLE:  FLODS_AUDIT_DATA_SM00'

PRINT '|  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

PRINT '|'


CREATE TABLE FLODS_AUDIT_DATA_SM00 (

AUDIT_DATA_ID NUMERIC(18, 0) NOT NULL,

CREATED_DT DATETIME NOT NULL,

CREATED_BY_ID VARCHAR(100) NOT NULL,

OBJECT_ID VARCHAR(30),

CREATED_TIMELINE_ID VARCHAR(100) NOT NULL,

CREATE_BY_ID VARCHAR(100) NOT NULL

CONSTRAINT FLODS_AUDIT_DATA_SM00_PKI PRIMARY KEY

(

    FLODS_ID

)

)


GO

The issue seems to be that there are two columns called CREATE_BY_ID, I got the template (probably not write word) from the company wiki and it came with 2 coloumns named the same. I have tried changing what the second column is called to prevent this but then I get different error messages
Msg 1911, Level 16, State 1
Msg 1750, Level 16, State 1

Please help or give me any ideas you may have becuase at the minute I'm at a stop.

#2
LuthfiHakim

LuthfiHakim

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 763 posts
I am not familiar with what you are refering with MSS. But I think the table structure DDL was generated in faulty, or in the MSS system it's okay to immediately alter properties of a column in the same time when it is created. I got the latter feeling since the second definition of CREATE_BY_ID is actually using the same type of data, but in more "complete" information (adding constraint and declaring it as primary key).

I think it's okay to just remove the first definition of CREATE_BY_ID column.

#3
stevie754

stevie754

    Programmer

  • Members
  • PipPipPipPip
  • 110 posts
Thanks a lot LuthfiHakim, Turns out the brief I had been given had them named wrong and I was breaking because a certain field was needed that hadn't been given in the brief. So it was my bosses fault lol.

Thanks for getting back to me + rep

#4
LuthfiHakim

LuthfiHakim

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 763 posts
Lol, so actually there's no problem at all? Thanks for the +rep!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users