Insert query

  • Hello all

    I am writing query as

    create table tbl

    ( name as varchar2 not null )

    insert into tbl

    (

    Select name from account

    union

    Select name from customer

    union

    Select name from party

    )

    system gives me error.

    Please guide me am i writing wrong query or system donot permit insert using 'union or union all' query.

    Please help...

  • hi,

    i think it might be that ur name field u said is not null...try to declare it as null....i dont have sql server installed at home...so cant test...sorry....just try....

  • VARCHAR2 is not a valid data type in SQL Server.

    Try the following

    create table tbl (

    name as varchar(50) not null

    )

    GO

    insert into tbl (name)

    Select name from account union

    Select name from customer union

    Select name from party

    .

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply