Home Forums SQL Server 2008 T-SQL (SS2K8) create table by using select command return data? RE: create table by using select command return data?

  • sorry Boss, the same error come again

    I m using SQL 2K8 R2 64 bit-version.

    IF EXISTS(SELECT 1 FROM sys.objects where name='NewTable' and type='U')

    begin

    DROP TABLE NewTable

    end

    GO

    select *

    into NewTable from tbl_contract_emp_master TR inner join

    TBL_IRIS_IMAGES_MASTER tm on tr.guid=tm.guid

    and EP_NO in ('104536884','104541256','104564417','t12035676','104567770','104556221','104567536')

    Erorr

    Msg 2705, Level 16, State 3, Line 1

    Column names in each table must be unique. Column name 'GUID' in table 'NewTable' is specified more than once.

    this below code working fine, but not able to create table New Table

    select tr.[GUID]as gid,[EP_NO],[NAME],

    [CONTRACTOR_CODE],[CONTRACTOR_NAME],

    [SUBCONTRACTOR_NAME],[PLANT_CD],[SKILLCODE],[WORK_AREA],

    [DISCIPLINE],[PASSTYPE],[PRES_ADD],[PRES_VILLAGE],

    [PRES_TALUKA],[PRES_DISTRICT],[PRES_TEHSIL],[PRES_CITY],

    [PRES_STATE],[PRES_PIN],[PRES_TEL_NO],[FATHER_HUS_NAME],

    [DT_BIRTH],[DT_JOIN],[EP_VALID_TILL],[LICENSE_NO],

    [GENDER],[BLOOD_GROUP],[RELIGION_CD],[ID_MARK],[HEIGHT],

    [DT_LEAVE],[COMMENT],[STATUS],tr.[ENROLLTIME] as EntTime,

    tr.[OPERATORID] as OptID, [MODIFY_DT],[CONTRACTOR_TYPE],[WORKAREA_CATEGORY]

    from TBL_CONTRACT_EMP_MASTER TR

    inner join

    TBL_IRIS_IMAGES_MASTER tm on tr.[GUID]=tm.[GUID]

    and EP_NO in ('104536884','104541256','104564417','t12035676','104567770','104556221','104567536')