Click here to Skip to main content
15,036,441 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 2 table name city and state:
city table field:

state table field:

i create store procedure:
ALTER PROCEDURE [dbo].[testreport]
    select * from City_master
    select * from State_master

when i add this to crystal report
only city_master column are display in database field

how can i see all 6 of column in database field

i does not know more about crystal report

thanks in advance.....
priyanshbhaliya 8-Dec-13 10:18am
can i use to different store procedure????
1 for state
2 for city
JoCodes 8-Dec-13 10:42am
To use Union operator you should have same column names...Use a join instead
[no name] 8-Dec-13 10:54am
Union in conjunction with select * is a bad idea anyway

Union Operator wont solve your problem .

You should use Join operator
[no name] 8-Dec-13 10:55am
Union in conjunction with select x.* is a bad idea anyway
priyanshbhaliya 8-Dec-13 11:12am
[no name] 8-Dec-13 11:43am
Excuse me please, that was a little superficial.What I like to say is, with union I prefer to list the fields of both seletcs explicitly.
JoCodes 8-Dec-13 23:52pm
Union needs to satisfy conditions such as number of fields, datatype, fields etc to be same in both the tables.
For Crystal report instead of using store procedure you can use View also.
Please try following code:
CREATE VIEW [dbo].[vw_testreport]
select c.*,s.state_name,s.country_id from City_master c
inner join State_master s
on s.state_id=c.state_id

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900