Hi,
you can try it by converting data type in your select statement..
create table table1
(
name varchar(10),
allowance int
)
create table table2
(
name varchar(10),
)
insert into table1 values('amit',1000),('arun',2000),('nitin',1000)
insert into table1 values('ajay'),('kamal'),('kunal')
SELECT Name,Convert(varchar,allowance) as Allowance
FROM Table1
UNION ALL
SELECT Name ,'' as Allowance
FROM Table2
Output:
Name Allowance
amit 1000
arun 2000
nitin 1000
ajay
kamal
kunal
And in case of above table structure.. your query is also not giving any error..
SELECT Name [Name],
allowance [Allowance]
FROM Table1
UNION ALL
SELECT name [Name],
'' [Allowance]
FROM Table2
OutPut:
Name Allowance
amit 1000
arun 2000
nitin 1000
ajay 0
kamal 0
kunal 0