Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Insert query Expand / Collapse
Author
Message
Posted Saturday, October 11, 2008 12:18 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, October 11, 2008 12:09 AM
Points: 3, Visits: 7
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...
Post #584345
Posted Saturday, October 11, 2008 4:06 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: 2 days ago @ 6:40 AM
Points: 534, Visits: 1,043
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....
Post #584365
Posted Sunday, October 12, 2008 10:22 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, December 24, 2013 4:42 AM
Points: 460, Visits: 2,523
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



.
Post #584647
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse